HTML blocks

Introduction

When creating HTML email templates, users usually need to reuse some parts of the HTML so the emails have consistent form. It is possible in Exponea to create custom HTML blocks for e.g. header, footer, images, or any other part of the email that is used often in the templates. These blocks can then be easily accessed when creating HTML templates, so the user does not need to recreate the HTML code from scratch, but can dedicate the time to the content instead.

Functionality

Using HTML blocks

Blocks can be inserted into the HTML using the plus sign in the bottom right corner of the editor. There you can then select the desired template and the way of input to the code.

HTML blocks

using blocks

It is possible to use HTML blocks in two ways:

  • Copy as HTML – this will take the 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 or consider language variants.
  • 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.

It is also possible to insert parameters into the template, which can then be changed in each template separately even when used as a reference. This will prompt the option to choose the value of the parameter when the block is selected.

HTML blocks parameters

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 HTML blocks

You can create as many blocks as required, and can be used in any future HTML template. HTML blocks cannot be used in visual templates, as they are created using BeeFree editor.

Creating a new block

When creating a new block, you simply enter the HTML you wish to have stored for later use, and name your block and save it. You can also create language variants (more in email templates guide), and insert uploaded images easily and access personalization wizard by clicking on the plus sign in the right bottom corner.

blocks new

New parameters can be inserted into the code using the method below:

 [[ parameterName | default value ]]
  • Replace parameterName with your desired naming of the new parameter. It is advised to choose humanly understandable names, as you will then be able to easily identify it when choosing the block.
  • default value – the default value has to be a constant of your choosing, personalization cannot be used here. This also applies for choosing the parameter later on.