Liquid is an open-source template language that allows you to take personalization of emails to the next level.  Maropost Marketing Cloud uses Liquid scripting to dynamically display email content containing data from standard and custom fields, dynamic content blocks, relational tables, content feeds, and transactional messages.

Liquid Filters

String Manipulation

Liquid scripting allows the use of filters that manipulate data and changes the form it takes. Filters can be used to personalize Subject lines as well as Email content.

Filters are denoted by the pipe character | and are placed within an output tag {{}}

An example is capitalizing the end-user’s name:

INPUT: {{contact.first_name | capitalize}}

OUTPUT: Ben

Or to downcase a name

INPUT: {{contact.first_name | downcase}}

OUTPUT: ben

Date/Time Formatting

Another great example is the date filter. It converts the timestamp into another data format:

INPUT: {{other.time_stamp | “%a, %b, %d, %y”}}

OUTPUT: 26 October 2016

  • The format for this syntax is the same as strftime

Cryptographic Hashing

MD5 hash is a cryptographic function that converts a piece of data, like an email address, into a 32-character hexadecimal string.  

INPUT: {{contact.email | md5}} OUTPUT: 20332b7bb9fb981a16346092956278e1

This filter is particularly helpful for those looking to include personalized advertising within emails. The unique 32 character string enables third-party advertising services to build profiles on recipients as emails are opened and display ads clicked without any actual exchange of email addresses taking place.

Conditional Logic

Liquid script supports IF/THEN/ELSE conditional logic for displaying email content.  Dynamic Content Blocks also provide this same type of conditional content.  Use Liquid script when the conditional rules are solely based on standard and custom field values, and the content to display are relatively simple.  Use Dynamic Content Blocks with both the rules and the content are more complex.

Default Display for First/Last Name

An IF/THEN/ELSE conditional statement is helpful to display a default first name or last name when none exists for any given contact.

Hello {% if contact.first_name == empty %} valued member {% else %} {{contact.first_name | capitalize}} {% endif %}

Note that you’ll use the Liquid keyword empty or blank to test whether a standard field is empty or not for any given contact.

Default Display for Custom Fields

Using conditional logic for a custom field is slightly different than that used for a standard field. The reason is that Maropost Marketing Cloud only stores the custom fields of any given contact for which there is a value for that field.  In contrast, all contacts have the standard fields regardless of whether the fields are empty or not.

Therefore, when testing for whether a contact has a value for a given custom field, the real condition is to test whether the custom field exists or not for any given contact.

Your balance is {% if contact.points %} {{contact.points}} {% else %} 0 {% endif %} points