Handlebars in OL Connect
Handlebars is the name of a JavaScript library that implements a templating language (see https://handlebarsjs.com/). It uses a template and an input object (i.e. data) to generate output.
The template looks like regular text with embedded Handlebars expressions. A handlebars expression is some contents enclosed by double curly braces: {{ ... }}.
Example: <p>Hello {{firstname}}!</p>
When the template is rendered, these expressions are replaced with values from an input object.
The Handlebars library is integrated in OL Connect Designer. This means that:
-
Handlebars expressions can be used in all sections as of version 2022.2.
Note: In templates made with OL Connect 2022.1 or older, Handlebars expressions are not evaluated by default. To enable expressions in a section, right-click the section in the Resources pane, select Properties and check the option Evaluate Handlebars expressions.
-
Handlebars expressions can be used in a special type of snippets called "Handlebars templates" or "partials". These were introduced in version 2022.1. Handlebars templates can in turn use other Handlebars templates as snippets. See Handlebars templates.
Expressions are inserted in sections and Handlebars templates the same way; see Variable data in text: expressions.
More about expressions and the functions that you can use in expressions can be found in the topics Handlebars expressions and Using functions in expressions: Helpers.
Note: The information in this Online Help focuses on the implementation of Handlebars in OL Connect. For general information about Handlebars and how to use it, see the following web sites: https://handlebarsjs.com/ and https://devdocs.io/handlebars.