Work with the Handlebars Templates

Antora combines the Handlebars templates with the converted AsciiDoc content to make the pages in the site. These “logic-less” templates are mostly HTML with some special mustache tags sprinkled in where content is to be inserted.

What do the templates do?

The layout templates, which are stored in src/layouts/, provide the main page structure. The partial templates, in src/partials/, fill in different regions of a page, such as the navigation and footer.

The templates read from a model that’s populated by Antora. Places in the template where the model is read are enclosed in {{ and }} markers or {{{ and }}}, aka mustaches (e.g., {{{page.title}}}). Double mustaches escape the content, whereas triple mustaches insert the content verbatim. When the {{ is immediately followed by >, that’s where the result of a partial is inserted (e.g., {{> head }}.

Template variables

This model is not final. Variable names and purposes may change.

Here’s an overview of the available UI model:

Table 1. Variables available to the Handlebars templates
Name Description


Information about the site.


The base URL of the site, if specified.


The title of the site.


A collection of all the components in the site.


Information about the site UI.


The default page layout used for this site.


The absolute base URL of the UI.


Information about the current page.


The page title (also used as the primary heading).


The main article content in HTML format. Sourced from AsciiDoc and converted to HTML by the Asciidoctor processor.


AsciiDoc header attributes that are prefixed with page-. The page- prefix is dropped from these names.


The text of the description attribute in the AsciiDoc header, if specified.


A comma-separated list of keywords defined in the AsciiDoc header, if specified.


Information about the component for the current page. Properties include name, title, and versions.


Information about the component version for the current page. Properties include name, title, and url.


The name of the module for the current page.


The name of the version for the current page.


All versions of the current page, including the current page. Each entry has the properties url, string, and missing.


An array of breadcrumb items that represent the current selection in the navigation tree.


A collection of navigation links for the current page. Each navigation item contains the property content as well as the optional properties url and (child) items.


The URL for the current page. This value is a root-relative path. It’s often used as the base URL to generate relative URLs from this page.


The canonical URL for the current page. If there are older versions of the page, the canonical URL is the URL of the latest version.


The URL to edit the current page, typically on GitHub.


Indicates whether the current page is the home page of the site.


The page layout for the current page.

The next logical page in the navigation tree.


The previous logical page in the navigation tree.


The parent page in the navigation tree. Will resolve to grandparent if parent item is not a page.


The path to the root directory of the UI.

This model is likely to grow over time.

Modify a template

Let’s consider the case when you want to add a new meta tag inside the HTML head.

First, make sure you have set up the project and created a development branch. Next, open the file templates/partials/head.hbs and add your tag.

<meta class="swiftype" name="title" data-type="string" content="{{page.title}}">

Each template file has access to the template model, which exposes information about the current page through variable names. The variables currently available are listed in Variables available to the Handlebars templates.

Save the file, commit it to git, push the branch, and allow the approval workflow to play out.