Syntax, placeholders, conditions, functions, and practical examples.
Giotto is the markup language used to create magnews templates: it makes newsletters and pages dynamic by inserting proprietary placeholders , expressions and visibility conditions.
Introduction
Giotto is the templating system used by magnews to personalize newsletters, emails, landing pages, and dynamic content.
Through placeholders, expressions, variables, conditions, and functions, Giotto lets you display different content based on contact data, workflows, and external data sources.
This guide collects all the official documentation for the Giotto language, with practical examples and complete references.
How this guide is organized
- Placeholder syntax
- Placeholder families
- Data formatting
- Logical operators
- Expressions
- Conditions
- Functions
- Variables
Syntax
A placeholder is enclosed in square brackets and follows this format:
[keyword:name{default value} attribute1=value1 attribute2="value 2"]
| Element | Syntax | Notes |
|---|---|---|
| Tag delimiter | [....] |
They open and close the tag |
| Separator | : | Separates the keyword from the field name [contact:name] |
| Default value | { ... } |
Used if the value is empty [contact:name{Customer}] |
| Attributes | attribute=attributevalue |
Attributes must be separated by spaces |
| Attribute value |
" " or ' ' or unquoted |
Quotes are used for string values and when the value contains spaces |
EXAMPLES:[contact:email] → Returns the contact's email address
[contact:name{Cliente}] → Prints the contact's name and, if empty, prints the word "Customer"
Placeholder Families
Each placeholder belongs to a family identified by the initial keyword.
| keyword | Description | Example |
|---|---|---|
| contact | Prints the value of a contact field | [contact:idfield] |
| contactstats | Prints a contact's statistics related to the email channel |
[contactstats:sent] [contactstats:received] |
| message | Prints the value of a message | [message:fromname] |
| link | Prints a system link | [link:unsubscribe] |
| ico | Prints a system icon | <img src="[ico:facebook]"> |
| var | Prints a global, context, or database variable | [var:mydatabasevariable] |
| workflow | Prints a workflow variable. | [workflow:myvariable] |
| survey | Prints the value of a survey field (to be used when the question is not on the same page as the button) | [survey:NOMECAMPO] |
| form | Prints the value of a form field (to be used when the response value is on the same page as the button) | [form:NOMECAMPO] |
If the workflow variable was named id_variabile and you reference it in the placeholder with the syntax: [workflow:ID_VARIABILE], it will not be rendered correctly.
Complete list of all keyword families >>
View the list of all system placeholders >>
Formatting
Transform and format text, numeric data, and dates using the following attributes.
| Attribute | Description | Example |
|---|---|---|
| prefix | Prints a string before a value. | prefix='' |
| suffix | Prints a string after a value. | suffix='' |
| left | Prints the first X characters. | left="X" |
| right | Prints the last X characters. | right="X" |
| Formats the string. | print="uppercase" | |
| encode | Prints the string using the specified encoding | encode='encodehtml' |
| separator | Character used as a separator. | separator=',' |
View the guide to all available formatting options >>
Logical operators
Giotto supports comparison, logical, and arithmetic operators.
- Comparison:
eq,neq,gt,gte,lt,lte - Logical:
and,or,not - Arithmetic:
+,-,*,/,mod
Expressions can read data from different sources, for example:
contact.values.ZONA, , temp.item.title, param.contact_field
Logical conditions (if else)
Conditional logic in Giotto exists in two complementary forms: conditional blocks and conditional functions. In the linked guide you can see the syntax and several examples. The main attributes are the following:
- mn:if
- mn:elseif
- mn:else
- fn.if()
Go to the complete guide on visibility conditions >>
Functions
View all available functions.
Functions can be of the following types:
- string functions
- date functions
- list functions
- mathematical functions
Go to the guide to all functions >>
Expressions
The eval:expr scope is the most powerful placeholder: it evaluates an expression and prints the result.
It lets you perform calculations, concatenations, formatting, and conditional logic directly in the communication without having to modify the template code; in fact, the code can be copied into a text element (HTML view).
[eval:expr value="<expression>"]
[eval:expr value=<expression> {default} attribute=value]The value can be written in quotes (recommended when it contains spaces or string literals) or unquoted for simple variable references.
View the guide for practical EVAL examples >>
Variables
The platform provides dynamic placeholders: you can use temporary, workflow, and database variables.
| Variable | Description | example |
|---|---|---|
temp: |
Temporary variables
|
[temp:item.NOMECAMPO] |
var: |
Database or journey variables (brandkit) | [var:BRAND_TEXT_FOOTER]. |