Skip to main content
How Do I Use Liquid Syntax? πŸ’§
Updated over 4 months ago

Heeeeey lemlister! πŸ‘‹

Can't wait to have your keyboard clattering brilliant cold emails? Let's unveil one of our lemlisters' secret asset: liquid syntax.

Let's go!

First of all, be advised there should be no spaces in the variables. Here are 4 possible ways you can create the variable:

  • camelCase

  • PascalCase

  • snake_case

  • kebab-case

So, instead of writing "My custom variable" we will write:

  • myCustomVariable

  • MyCustomVariable

  • my_custom_variable

  • my-custom-variable

Now that's clear, let's dive deep in creating liquid syntaxes!

😲 How does it work?

The liquid syntax includes many logical and comparison operators.

πŸ‘‰Personalizing Greetings

First of all, we need to create a civility variable on each lead, which will allow us to determine if we should write Mister or Miss.

Then, in your email step, you can add:

{% if gender == "male" %}Hello mister,{% endif %}

or

{% if gender == "male" %} Mister, {% else %} Miss,{% endif %}

πŸ‘‰Dynamic Content Based on Job Titles

{% if position == "founder" %} As founder, you have to learn to delegate. {% endif %}

another example

{% if job_title contains 'Manager' %} As a manager, you understand the importance of...{% else %} I wanted to reach out because... {% endif %}

Just please make sure if you add the variable job_title in the syntax, your variable in the Lead list needs to be named exactly the same in order to work!

You can use multiple operators in a tag. πŸ‘‡

{% if type == "freelance" or type == "smb" %} We know it's not easy as a small company {% endif %}

πŸ‘‰Greetings based on the time zone

It is important to know the liquid syntax is based on our server time in France and not on the campaign timezone. In this case, you must make the conversion in order to add/withdraw the difference of timezone they have with our servers in France.

Syntax rendering:

Code:

{% assign now = "now" | date: "%H" %}{% if now < 12 %}Good Morning ! {% elsif now < 18 %}Good Afternoon ! {% else %}Good evening !{% endif %}

or

{% assign hour = "now" | date: "%H" | plus: 0 %}{% if hour >= 17 %}Write text plus for past 17:00{% else %}Write text for previous 17:00{% endif %}

Plus -> where to add hours when they have timezone + compare to France

Minus -> where to withdraw hours with the France timezone

🚨 Pro tips 🚨

If the syntax does not work:

  • check if the brackets are well-opened and closed.

  • make sure if you're using a variable that it does not contain any space in it ("myVariable" and not "my Variable").

  • check if the text corresponds well to the variable.

It is very simple:

{% if myVariable == "text" %} my text {% endif %}

If "myVariable" for the lead is equal to "text" it works, if you write "txt" in your liquid syntax it is not going to work, same for "my text", "texts" etc ...

βš—οΈ What can I do with it?

πŸŒ€ Spin syntax

With spin syntax, you will be able to get multiple variations of a sentence that will be picked up when the email is sent.

{% spin %} {% variation %} I really want to talk with you. {% variation %} I think we should meet. {% variation %} What if we take a coffee. {% variation %} I really like your shoes. {% endspin %}

For each email lemlist will send, it'll pick one of those variations. You can see the result in the Preview panel, each time you open it, the sentence in the preview will change.

πŸ—“ Get the day of sending

To get the day of sending, you have to use the filter "date" with the format "%A". You can find other formats here.

lemlister tip πŸ’‘ Don't forget to replace {{ }} with {# #} as a double curly bracket is already used in lemlist for custom variable syntax.

 {# "now" | date: "%A" #} 

If you want to use other formats you can take a look at the strftime page.

If you want to display the date in another language than English, you can use a "case" like this:

⚠️ Warning ⚠️

The formatting of the liquid syntax is important. If we skip lines, come back to the line ... in the middle of a syntax, this will be taken into account in the formatting of the mail. That's why we write everything on one line, without indenting the code, even though it's more complex to read

{% if icebreaker != blank %} {{ icebreaker }}{% endif %}

β‰ 

{% if icebreaker != blank %}{{ icebreaker }}{% endif %}Here is a video to do it step by step together 😊

Enjoy ❀️

Did this answer your question?