Merge codes

Learn how merge codes allow you to create custom look and feel.

What are merge codes?

Merge codes act as placeholders for content. KnowledgeOwl replaces the merge code with the appropriate content when it builds the page. They are mainly used when creating custom layouts, look and feel. They can also allow you to create dynamic content.

Example one: creating custom layouts

When creating a custom article layout, adding the [article("title")] merge code results in KnowledgeOwl displaying the article title at that point in the document.

Example two: adding pieces of functionality

There are also merge codes that add larger pieces of functionality. For example, [template("up-articles")] causes KnowledgeOwl to display a list of recently updated articles.

Using this HTML:

<h1>This is a title</h1>
<p>And this is your article content.</p>
<p>Now, imagine you want a list of recently updated articles at the end of this page . . . </p>
[template("up-articles")]

Results in this:

Screenshot of a knowledge base output featuring a title, some dummy content, and an auto-generated list of recently updated articles.

Article

Here are the available template merge codes for use in Settings > Style > Article Styles > HTML. Article merge codes work in categories and sub-categories too.

Template Merge CodeDescriptionExample
[article("body")]The "body" merge code will display the contents of the current category or article.See note.
[article("title")]The "title" merge code will display the category or article title. Article Merge Codes
[article("toc_title")]The "toc_title" merge code will display the Table of Contents Title (if set).Article
[article("pdf_download_tool")]The "pdf_download_tool" merge code will display a PDF icon that will download the contents of the current category or article when clicked.
[article("date_created")]The "date_created" merge code will display the date and time the current category or article was created.07/12/2015 12:24 pm MDT
[article("date_modified")]The "date_modified" merge code will display the date and time the current category or article was last modified.09/12/2019 2:16 am MDT


Note: This merge code does not work inside articles. If it did, it would create an infinite loop of loading content inside of content. It might be fun to see, but it would break KnowledgeOwl horribly.

Homepage

Here are the available template merge codes for use in Settings > Style > Custom HTML > Home Page. These merge codes will only work in the knowledge base home page; they will not work inside categories or articles.

Homepage Merge CodeDescriptionExample
[homepage("title")]The "title" merge code will display whatever text you have in the Home Page Title field under Knowledge Base > Home Page. You can change title here.NA - will not work in articles
[homepage("body")]The "body" merge code will display the content inside the Home Page Body field under Knowledge Base > Home Page. You can update the content here.NA - will not work in articles



Reader

Here are the available template merge codes for use in any of the following locations:

  • Settings > Style
  • Knowledge Base > Home Page
  • Knowledge Base > Articles
  • Knowledge Base > Contact Form
Template Merge CodeDescription
[reader("username")]The "username" merge code will display the current reader's username / login.
[reader("first-name")]The "first-name" merge code will display the current reader's first name.
[reader("last-name")]The "last-name" merge code will display the current reader's last name.
[reader("full-name")]The "full-name" merge code will display the current reader's first and last name.
[reader("groups")]The "groups" merge code will display a comma-separated list of the current reader's groups.
[reader("ssoid")]The "ssoid" merge code will display the current reader's SSOID. Only shows anything for readers logging in through Single Sign-On.
[reader("custom1")]The "custom1" merge code will display whatever is specified in the Custom 1 field for any given reader.
[reader("custom2")]The "custom2" merge code will display whatever is specified in the Custom 2 field for any given reader.
[reader("custom3")]The "custom3" merge code will display whatever is specified in the Custom 3 field for any given reader.
[reader("custom4")]The "custom4" merge code will display whatever is specified in the Custom 4 field for any given reader.
[reader("custom5")]The "custom5" merge code will display whatever is specified in the Custom 5 field for any given reader.

Body

Here are the available template merge codes for use in Settings > Style > Custom HTML > Body. All merge codes except "contents" will also work inside articles.

Template Merge CodeDescriptionExample
[template("project-logo")]The "project-logo" merge code will display whatever image you have uploaded under Settings > Style > Logo. You can change the logo there or by replacing the original file in your library.Knowledge Base Logo
[template("project-name")]The "project-name" merge code will display the knowledge base name from Settings > Basic.KnowledgeOwl Support
[template("contact")]The "contact" merge code will display a "Contact Us" link to your contact form if you have this feature enabled. You can enable your contact form under Knowledge Base > Contact Form. You can also customize your contact form link or add it to the table of contents.Contact Us
[template("searchbar")]The "searchbar" merge code will display a search bar with the text "Search for articles".
[template("contents")]The "contents" merge code will display the contents of the current page whether that is the home page, the contact form, or an article.See note*.


*Note: This merge code does not work inside articles. If it did, it would create an infinite loop of loading content inside of content. It might be fun to see, but it would break KnowledgeOwl horribly.

Other

These merge codes can be used in Custom HTML but also in individual articles, categories, etc. See usage notes:

Template Merge CodeDescriptionUsage
[template("object-id")]The "object-id" merge code can be used in articles and categories and will pull the ID of that article or category. Generally this is most useful in API snippets or for advanced logic that depends on a particular ID being present.Can be used in Custom HTML > Article and in individual articles and categories. Adding it to other pages will cause a silent failure. Doesn't work in snippets.