Liquid markup lets you tailor content to each individual viewer by using dynamic data in your email campaigns, pages, and forms. With the Loop, Decision, and Liquid building blocks in EasyEditor, you can display personalized content based on customer behavior, preferences, and data stored in your account. Whether you're showcasing recent purchases or customizing messages based on contact data, these tools help you deliver relevant, engaging experiences at scale.
What is Liquid?
Liquid is a flexible, open-source markup language originally developed by Shopify. It lets you create content that adapts to your data—so you can show different messages, images, or layouts depending on who’s viewing your campaign.
In Dotdigital, Liquid acts as a dynamic layer on top of your HTML and CSS, helping you personalize emails, pages, and forms at scale. It’s widely used and easy to learn, especially for front-end developers. For a deeper dive into what Liquid can do, check out the official Liquid documentation on Github.
Before you start
Things you need to know:
We support an extensive subset of the Liquid markup language. However, not all elements are available.
You must have Dynamic Personalisation turned on for your account.
Liquid for SMS or MMS works differently.
Learn more in Personalisation for SMS and MMS.There are reserved variable names that you cannot use, as they are reserved for system-defined values:
account
contact
token
campaign
Custom code
The examples provided in this article intend to help you understand the purpose and application of the Loop, Decision and Liquid markup building blocks, however using Liquid markup for personalisation is classed as custom code. Our Support team cannot troubleshoot your Liquid markup.
Loop block
The loop block repeatedly runs a block of code using specific types of insight data within your account.
In the following example we create a loop that displays a customer’s top five latest orders:
Step 1. Set up a Collection
In EasyEditor, under Liquid, select and drag a Loop building block onto the canvas.
Select the block’s Configuration icon in the top right corner of the block.
Expand the Order by drop-down menu and choose the field you want to order the collection by.
Expand the Order by drop-down menu and choose the field you want to order the collection by.
Another drop-down menu appears beneath. Expand it and choose how the collection is ordered.
In our example, we chose purchase_date so we can choose to order the collection by Latest first or Earliest first.
For Limit, increase or decrease the number of orders displayed in the loop according to your needs.
Expand the Columns drop-down menu and choose the number of columns you want the data to display across.
Select APPLY.
This loop is now configured to show latest orders. Next, we need to set the order data we want displayed.
Step 2. Configure Order data
In EasyEditor, under Liquid, select and drag a Loop building block inside your collection loop block.
Select the block’s Configuration icon.
Expand the Select collection drop-down menu and choose products. This is the Order property.
Expand the Order by drop-down menu and choose name.
This causes another drop-down menu to appear beneath. Expand it and choose how the collection is ordered.
Because we chose name, an alphabetical field, we can choose to order by A-Z or Z-A.For Limit, increase or decrease the number of orders displayed in the loop by using the arrow buttons or entering a number.
Select APPLY.
We now have two loop blocks that check the collection (Orders) and retrieve the data and orders it bypurchase_date
.
Step 3. Add personalisation values
The last thing we need to do is to add the action to the loops. To do this, you can add the name value for the products inside the latest purchase for this collection.
In EasyEditor, under Content, select and drag a Text block inside your loop block.
Select the block, then select DATA FIELDS from the toolbar.
Choose the data fields you want to display. For example, product_id, or name. The data fields you see here are relevant to the loop you have created.
For better formatting, make sure to add additional data fields to a new line in the text block.Select SAVE.
You’ve now set up a loop that dynamically displays personalized data—like recent orders—based on Insight data collections in your account.
Decision block
The Decision block sets decision criteria and returns one value for a TRUE result and another for a FALSE result, commonly known as an IF statement.
In the following example we create a loop that displays a customer’s orders if the price is less than 30:
Create a loop block that’s configured to display Orders data.
To learn more, see Set up a collection.
Under Liquid, select and drag a Decision building block inside the orders loop block.
Select New content, then enter your condition in the When field. For example: Orders.order_total < 30.
This shows orders where the total is less than 30.
Select APPLY.
Under Liquid, select and drag a Liquid markup building block inside decision block and enter the name value. For this example:
Orders is the collection name, and the name value is ID, so enter: ####{{ Orders.ID }}.
To learn more, see Name value.
The decision block now checks for orders where the order_total value is less than 30 and displays them if TRUE, otherwise nothing is displayed.
You can set a rule for returning data when the decision is FALSE by placing a loop inside the Otherwise part of the decision block.
For more information see Loop block.
With the Decision block, you can control what content appears based on specific conditions, helping you tailor messages even further using simple logic.
Liquid markup block
The Liquid markup block is a blank block which you can use for any custom Liquid code.
To use the Liquid markup block:
In EasyEditor, under Liquid, select and drag a Liquid markup building block onto your canvas.
Select the block’s Configuration icon.
Enter your custom liquid code.
Select APPLY.
The Liquid markup block gives you full flexibility to write custom Liquid code, so you can create advanced personalisation beyond what’s possible with prebuilt blocks.