These docs are for v3.2. Click to read the latest docs for v5.0.

Handlebars

Commonly used Handlebar Tokens

Tokens

{{Name}} Name of a property in your schema
{{@index}} Index of the Item inside an {{#each Items}} list
{{Context.ModuleId}} Current Module ID
{{Context.ModuleTitle}} Current Modules Title
{{Context.PortalId }} Current Portal ID
{{Settings.Name}} Reference to a setting

{{../Name}: Name of a property one level up the tree (you use this when you want to address a "root" property when inside a list of Items using {{#each Items}}

Advanced:
{{Schema.properties.xxx}} Reference to a property in your Schema

Serverside Handlebars Helpers

HelperBlock HelperparametersOutputExample
equalYes2 strings{{#equal Title "Text"}}
....
{{else}}
...
{{/equal}}
multiplyNo2 numbersnumber{{multiply SettingsColumns 2}}
divideNo2 numbersnumber{{divide SettingsColumns 2}}
addNo2 numbersnumber{{add @index 1}}
substractNo2 numbersnumber{{substract Settings.Columns 1}}
publishedYesarray
registerscriptNojavascript fileNothing
registerstylesheetNocss fileNothing
arrayindexNO
arraytranslateNo
formatNumberNo.net format , culture (or invariant)string
formatDateTimeNo.net format , culture (or invariant)string{{formatDateTime DateField "dd/MMM/yy" "nl-NL" }}
ifandYesmultiple variables to check
convertHtmlToTextNotextstring{{convertHtmlToText Description}}
truncateWords
(from version 3.1.2)
Notext, maxCharacters, trailingTextstring{{truncateWords Description 50 "..."}}
convertToJson
(from version 3.2)
Noany variablestring{{convertToJson article}}

Clientside Handlebars Helpers

Need to be added by yourself to to a javascript file. More info

Most of the times, only used in item template of multi document templates like articles.

if (typeof Handlebars != 'undefined') {
        Handlebars.registerHelper('formatDateTime', function (context, format) {

            if (window.moment && context && moment(context).isValid()) {

                var f = format || "DD/MM/YYYY";

                return moment(context).format(f);

            } else {

                return context;   //  moment plugin is not available, context does not have a truthy value, or context is not a valid date

            }

        });

       
    }