Skip to main content

Handlebars

Handlebars extends Mustache-style syntax with helpers and richer block expressions. Used when a directory contains template.handlebars (and no template.mustache).

<h1>Invoice {{number}}</h1>
{{#each items}}
<div>{{name}} {{price}}</div>
{{/each}}

{{#equal status "paid"}}Paid{{else}}Due{{/equal}}
<time>{{format_time "%Y-%m-%d" issuedAt}}</time>

Features

  • Block helpers ({{#each}}, {{#if}}, {{#with}}) and the built-in equal comparison block.
  • Helpers: format_time, markdown, embed_text, embed_base64, equal.
  • Partials via {{> name}}, including Markdown partials.
  • HTML-escaped by default; {{{triple}}} and the markdown/embed_text helpers emit raw HTML — do not feed them untrusted data.

Handlebars is the recommended engine for most dynamic documents: enough logic and helpers for real templates, while staying declarative.