HTML Blocks

When creating email templates, you usually need to reuse some parts of the HTML for headers and footers for example. Therefore, Exponea allows you to create custom HTML blocks (also called dynamic blocks, or dynamic content) that you can create once and then easily reuse across your email campaigns.

How to create an HTML block

You can create a new HTML block in in two ways:

  1. Go to Data and Assets > Asset manager > Blocks -> New block
  1. You can also create a new block directly within the email editors, whether you are building the email in the "Asset manager", "Email campaigns" or through an email node in a scenario. Use the (+) button at the bottom of the editor or node modal to open the Asset picker, select Blocks in the asset selector and choose the “New block” option.

Creating the content

When creating a new block, simply write the HTML code which you will want to reuse later. The functions available are similar to the normal email HTML builder, including multilingual support.

Inserting parameters

It is also possible to insert parameters into the block. Parameters allow you to insert a custom value within each email separately even when the block has been inserted as a "reference" (see below for explanation).

New parameters can be inserted into the code using the Template parameters functionality as illustrated below. Read more about using Template parameters.

[[ parameterName | default value ]]

Using the parameters will prompt the option to choose the value of the parameter when the block is selected within an email template.

Inserting HTML blocks into an email

Using the HTML editor

Click on the "plus" button in the bottom right corner of the editor as shown in the screenshots below. This button will open a modal with the asset picker for blocks and snippets. Selecting Blocks in the asset type will load available blocks from the Asset Manager. Note that if the campaign is a part of an initiative, it will only show assets from the same initiative, or assets marked as Global objects.

Selecting a block will open the block preview and parameters inputs in the top. When entering the parameters, the preview will be regenerated once you stop inputting values (click outside). After selecting and configuring the block, there are two ways of inserting it into your campaign.

  1. Copy as HTML
    This will take the full code from the default language template and copy it to clipboard. User can the simply paste the code into the desired HTML part. This code can be changed as desired, and will NOT be updated when the block is changed, neither will it consider language variants.
  2. Copy reference
    This will copy the reference to the block in jinja tags, that can be pasted into code. This will not allow changes to the code directly in the HTML and WILL be updated when the block is changed. You will only be able to edit the values of the parameters directly in your email HTML editor.

Please see also below how the block is seen in the HTML code. In the line 5 the block is copied as HTML, in the lines 6 and 7, the block is copied as reference:

Using the visual editor

Drag the "Dynamic content" into the canvas and then choose which block you want to insert.


Inserting parameters into Jinja

If the value of the parameter is to be inserted into a Jinja statement, the double square brackets [[ ]] need to be wrapped with quotes " or '. This is because the parameter value is inserted into the file as text.

{% set paramValue = '[[ parameterName | defaultValue ]]' %}

If the parameter needs to be interpreted as other data type than string, the value may be converted with from_json filter.

{% set paramValue = '[[ parameterName | defaultValue ]]' | from_json %}

Updated 4 months ago

HTML Blocks

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.

We rely on cookies

to optimize our communication and to enhance your customer experience. By clicking on the Accept and Close button, you agree to the collection of cookies. You can also adjust your preferences by clicking on Manage Preferences. For more information please see our Privacy policy.

Manage cookies
Accept & close

Cookies preferences

Accept & close