Skip to main content

Template Blocks

Use template blocks to insert markup language into your notification.

Availability: Email only

Working With Template Blocks

New Template Block

The Template Block allows you to use Handlebars templates along with HTML and CSS to add customized content to your notifications.

Template Block Boilerplate

The template block presents you with an HTML editor containing a div and style element. Starting with these elements, you can build out the look and feel of the block content.

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.

Using CSS With Handlebars

  1. In the notification designer, add a template block to an email notification.
Template Block With CSS and Handlebars
  1. Open the preview tab and create a test event providing the data values for the template block.
Test Event Data
  1. Select the test event in the preview to see the code rendered in the email.
Template Preview

Using Markdown in a Template Block

If you like to compose in markdown, you can do that using the template block. Just add a template block to your notification, add the following syntax:

<div>{{#markdown}} YOUR MARKDOWN GOES HERE {{/markdown}}</div>

Then write in your markdown between the {{#markdown}} and close with {{/markdown}}.

Template Block and Markdown
Markdown Preview

Using Replacement Variables in Handlebars

To insert a variable from your JSON event, you need the variable handlebars helper

{{var "variable_name"}}

Read More:

Inserting HTML Into a Handlebars Block

To pull in a data object variable containing HTML, wrap the variable with triple curly brackets like:

{{{body}}}
Was this helpful?