2022.1

Table Of Contents
web sites: https://handlebarsjs.com/ and https://devdocs.io/handlebars.
Creating a Handlebars template
To create a new, empty Handlebars template:
1. On the Resources pane, right-click the Snippets folder and select New Snippet.
2. Select the type of snippet that you want to create: Handlebars template.
3. Give the snippet a name.
4. Double-click the new file to open it in the Designer and fill it with HTML text and
Handlebars expressions.
The editor for Handlebars snippets does not have a Design view. HTML with Handlebars
expressions is not necessarily valid HTML. Processing it with an HTML parser might break
both the Handlebars expressions and the HTML.
More about expressions and the functions that you can use in them can be found in the topic:
"Handlebars expressions" on page449.
Using a Handlebars template in a section
Although Handlebars templates contain HTML text, they cannot be inserted into the content of a
section directly. The following steps need to be taken in order to replace Handlebars
expressions with values and then add the content of a Handlebars template to a section.
Render the Handlebars template
First the template needs to be rendered, i.e. converted into HTML, replacing the expressions
with values. This can be done with one line of code in a standard Designer script. Create a
standard script and call the function:
Handlebars.render(template, data).
For example:
var html = Handlebars.render( "snippets/policy-info.hbs", record );
The template can be:
Page 288