Toutes les collections
Newsletter
Variables
Creating, modifying and using a variable
Creating, modifying and using a variable

Among the variables "global" and "articles", you don't find the one that corresponds to your needs? Create one from the tab variables

Benjamin Carro avatar
Écrit par Benjamin Carro
Updated over a week ago

Variable syntax

Before starting to use variables, it is important to understand their syntax. As mentioned in the article "Knowledge base for the use of variables in a newsletter" that I invite you to read, we use the Mustache language to generate the variables in the dashboard.
To use the variables, here is the appropriate syntax to know:

{{variablename }} e.g. {{metadata.title }} or {{day }}, etc.

Some variables allow you to insert HTML code in the template. Therefore, three braces (instead of the usual two) must be put in the opening and closing braces to call an HTML variable e.g. {{{ metadata.image }}} or {{{ metadata.codeHTML }}}, etc.

It is important to understand these notions, even if the template editor is designed so that you don't need to use them since the variables are all accessible from a menu in the text editor.

Create a new variable

If among the variables "global" and "articles", you do not find the one that corresponds to your needs, you can create a new one from the tab "variables" so that it will be available in the tab "Template".

All new variables created manually will be accessible to the edito variables.

To create a new edit variable :

  1. Go to the "Variables" tab

  2. Click on the "Add a variable" button

  3. Name the variable in the window that just appeared on the screen.

  4. Insert the contents of the variable in the black "Value" window.

  5. Save the variable

Changing the value of a variable

Like the previous section of creating a new variable, this step is only available for editorial variables. In other words, it is not possible to modify a global or article variable.

  1. Go to the "Variables" tab

  2. Click on the "Variable" menu

  3. Select the variable you want to change

  4. Make your changes in the "Value" section

  5. Save your changes

Using a variable in the template

For the content of a variable to appear in a newsletter, the variable to which it refers must be added in the newsletter template.

Two methods are available to you:

  1. Use the text editor menu to add a variable (global, article and/or editorial)

  2. Insert directly the link with the Mustache language

Method 1 :
If it is a "Description" or "Title" block:

  1. Insert static text before the variable (this is not mandatory)

  2. In the text editor, choose between "Editorial variables", "Global variables" and "Article variables" (the latter will only be proposed if you have previously selected an "article block").

  3. Click on the variable to embed it in the content

  4. You can insert text before, after or between each variable

  5. Save your change

If it's an image:

The text editor is, of course, only displayed when editing text, so to add variables to images, the principle is the same, but it happens in the right sidebar "Parameters".

  1. Select the image

  2. In the right sidebar "Settings/Image", change the variables for the link or image path

  3. Save your changes

Method 2:

Follow the instructions in the Mustache documentation to add the variables manually.

Avez-vous trouvé la réponse à votre question ?