Loading...
Skip to main content

Template Blocks

Template Blocks allow you to leverage HTML, CSS, and Handlebars templating for highly customized email notifications in Courier. Template Blocks provide a powerful way to create dynamic, richly formatted content for your email notifications. They combine the flexibility of HTML and CSS with the dynamic capabilities of Handlebars templating.

Template Block Boilerplate
Note

HTML and CSS support varies by email client.

Handlebars Templating Language

The Template Block supports Handlebars. You can learn about the language syntax from the Handlebars Language Guide.

Read more: Custom Courier Handlebars helpers.

Styling with CSS and Handlebars

Combine CSS and Handlebars for dynamic styling:

Template Block with CSS and Handlebars

Using Markdown in a Template Block

Render markdown between {{#markdown}} and {{/markdown}} within a template block.

<div>
{{#markdown}}
# Your Markdown Content

- List item 1
- List item 2
{{/markdown}}
</div>

Using Replacement Variables in Handlebars

Insert variables from your JSON event data:

{{var "variable_name"}}

Read More:

Inserting HTML from Variables

To render HTML stored in a variable, use triple curly braces:

{{{htmlContent}}}