Template language
A Bigodin template is a string that produces an output when given a context. The context is a JSON-like value: numbers, strings, booleans, arrays, objects. The template references context fields, calls registered helpers, branches on conditions, and loops over arrays.
This section is a reference for the template-side syntax. For the host-side API (compile, parse, run, addHelper) see Library API; for the bundled block primitives (if, unless, with, each, return) see Block helpers.
Quick example
{{#if user.active}}
Welcome,
{{user.name}}! Your last 3 orders:
{{#each (slice user.orders 0 3)}}
-
{{@index}}.
{{this.product}}
({{this.total}})
{{/each}}
{{else}}
Account inactive.
{{/if}}
Topics
- Path expressions: reading values from the context with
{{name}}and dot notation - Comments:
{{! ... }}and the standalone-line rule - Raw output:
{{x}},{{{x}}},{{&x}}and why they all emit raw - Whitespace control:
{{~ ~}}to strip surrounding whitespace - Calling helpers: positional args, literals, and nested expressions
- Conditional blocks: truthy / falsy sections,
{{else}}, and{{else if}} - Loop blocks: iterating over arrays
- Iteration variables:
@index,@key,@first,@last - Block params: naming loop variables with
as |item index| - Negated blocks:
{{^name}}...{{/name}} - Context blocks: pushing context, walking with
$parent/$root/$this - Variables:
{{= $name value}}and reuse across statements
If you are coming from Mustache, also read Migrate from Mustache for a list of behavioral differences.