/
A Guide to using DotLiquid in content

A Guide to using DotLiquid in content

Liquid is a template language created by Shopify. It allows you to insert variables into text dynamically.

At Symend, we use the DotLiquid implementation to personalize emails, text messages, and landing pages. If you’re familiar with Liquid, there are some differences you should familiarize yourself with.



Basic Usage

Double curly braces {{ }} denote placeholders for variables and expressions used in personalization.

Variables are enclosed within {{ }} and represent dynamic values that will be replaced during rendering.

  • Variables in email and text message content are rendered at send time.

  • Variables in landing page content are rendered each time the page is loaded.

Example:

For a customer named “Jane,” this text template Hello {{Customer.FirstName}} will use the information know about the customer to render the output as: Hello Jane.


Common Filters

Liquid filters allow you to modify the output of variables in templates. Filters are applied using the pipe (|) character and are highly customizable. Below is a guide to some commonly used filters.


capitalize

Capitalize the first letter of the string.

Code
{{ "hello world" | capitalize }}
Output

Hello world

Tips
  • Combine capitalize with other filters like downcase to ensure uniform formatting before capitalizing the first letter.


downcase

Convert all characters to lowercase.

Code
{{ "Hello World" | downcase }}
Output

hello world

Tips
  • Use downcase to standardize text before comparisons or searches.


upcase

Converts all characters to uppercase.

Code
{{ "Hello World" | upcase }}
Output

HELLO WORLD

Tips
  • Useful for emphasizing text in headings or labels.


Custom Filters

These filters are custom to Symend and allow greater flexibility for presenting currency and dates/times in localized formats.


currency Symend

Formats monetary values based on locale settings.

Code
Output

1000 $1,000.00

Tips
  • Use locale codes (en-CA, fr-FR, etc.) to match audience preferences.

  • Ensure the variable holds numeric data to avoid errors.


customDate Symend

Formats dates using a specified format and optional locale.

Example (Canada English):

Code
Output

2024-03-29 March 29, 2024

Example (Canada French):

Code
Output

2024-03-29 29 mars 2024

Tips

For ordinal day formatting (e.g., "29th"), you may need custom logic as shown in the UK example:

Code
Output

2024-03-29 29th March, 2024


Tips for using Filters

Chaining

Combine multiple filters for complex transformations:

Code
Output

HELLO WORLD Hello world