Merge codes

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.

KB Merge Codes

Here are the available template merge codes in the KB merge codes list, which you can use in any of the Settings > Style, Custom HTML templates. Many can also be used directly within individual articles, categories, and subcategories.

Template Merge CodeDescriptionExample
[template("article-tags")]Creates a Tags: [hyperlinked tags] list for an article or category wherever it's used. The "Tags:" test is controlled by a setting in the Customize Text tool.
Tags: search subscription
[template("article-tag-names")]Creates a comma-separated list of the article tag names associated with a given article or category.
tag1,tag2,tag3,search,subscription
[template("project-logo")]Inserts the knowledge base logo set in Settings > Style. Used in the Default Top Navigation HTML
Knowledge Base Logo
[template("project-name")]Inserts the knowledge base's name, as set in Settings > Basic. Used in the Default Top Navigation HTML.
KnowledgeOwl Support
[template("contact")]Adds the link to Contact Form. Should be added somewhere in your knowledge base if you're using the Contact Form.
Contact Us
[template("glossary")]Creates a link to the Glossary page.
Glossary

Article

Here are the available template merge codes for use in Settings > Style, Custom HTML > Article. Many can also be used directly within individual articles, categories, and subcategories.

Template Merge CodeDescriptionExample
[article("body")]The "body" merge code will display the contents of the current category or article.This merge code only works in Custom HTML > Article. It 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.
[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 2:24 pm EDT
[article("date_modified")]The "date_modified" merge code will display the date and time the current category or article was last modified.12/28/2022 12:25 pm EST
[article["thumbnail"]]
The "thumbnail" merge code displays a thumbnail image, if one is set in the article editor.
[article["thumbnail"]]

[article["banner"]]
The "banner" merge codes displays a banner image, if one is set in the article editor.
[article["banner"]]
[template["rating"]]
The "rating" merge code displays the rating text and controls as set up in Settings > Article Ratings.

[template["comments"]]
The "comments" merge code displays the leave a comment options as set up in Settings > Comments.

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. This will work with both readers and authors.
[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.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.
[template("is-editor-check")]
Checks if the current viewer is an author. Returns a "true" value if the viewer is an author and a "false" value if they are not.true

PDF Merge Codes

We have several merge codes that can be used in the Standard, Custom, and Individual Article PDFs:

PDF Merge CodeDescriptionApplies to
[pdf("page-number")]
This will automatically add a page number to the PDFs. We recommend using this in either the header or footer.
Individual Article PDFs
Standard PDF
Custom PDF
[pdf("cover-title")]This will add the text from the Table of Contents Title for Standard and Custom PDFs. Cannot be used in Settings > PDF for Individual Article PDFs.
Standard PDF
Custom PDF
[pdf("date-created")]This will add the date the PDF was created. It can be used in the header, footer, or on a cover page. Cannot be used in Individual Article PDFs.
Standard PDF
Custom PDF

Custom content category merge codes

These merge codes can be used in Custom content categories to display subcategories.

Template Merge CodeDescription
[template("content-list")]The template content-list merge code will display subcategories in content list format.
[template("panel-list")]The template panel-list merge code will display subcategories in subcategory panel format.
[template("icon-cats")]
The template icon-cats merge code will display subcategories in the icon panel format. See Add category icons to your homepage category panels for additional options of working with this merge code.

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.