Learning Objective
By the end of this guide, you'll know how to use liquid syntax to create dynamic, personalized emails that adapt based on lead data, including conditional greetings, job-title-specific content, time-based messages, spin syntax for variations, and dynamic dates.
Why This Matters
Liquid syntax takes personalization beyond just . It lets you write one email that adapts content based on lead attributes (gender, job title, company type), sends time-appropriate greetings, and creates multiple variations to avoid repetitive messaging. This makes your outreach feel more personal and relevant, improving engagement without manually writing separate emails for each segment.{{firstName}}
Prerequisites
Before you start:
Campaign with email steps created
Lead data with custom variables you want to use (gender, jobTitle, companyType, etc.)
Basic understanding of custom variables in lemlist
Variable Naming Rules
Critical requirement: Variables must never contain spaces.
Allowed formats:
camelCase: myVariable, jobTitle, companyType
PascalCase: MyVariable, JobTitle, CompanyType
snake_case: my_variable, job_title, company_type
π‘ Match exactly: Variable names in liquid syntax must match your lead data field names exactly (case-sensitive).
1. Conditional Greetings Based on Gender
Adjust greetings based on the gender field in your lead data.
Syntax:
{% if gender == "male" %} Hello Mister, {% else %} Hello Miss, {% endif %}
or
{% if gender == "male" %} Mister, {% else %} Miss, {% endif %}
How it works:
If lead's gender field = "male", displays "Hello Mister,"
If gender field = anything else (or blank), displays "Hello Miss,"
Setup requirement: Your lead list must have a "gender" column with values like "male" or "female".
2. Dynamic Content Based on Job Titles
Personalize message content based on the recipient's role or position.
Simple job title check:
{% if position == "founder" %} As founder, you have to learn to delegate. {% endif %}
How it works: If the lead's position field = "founder", the sentence appears. Otherwise, nothing displays.
Using "contains" for flexible matching:
{% if job_title contains 'Manager' %} As a manager, you understand the importance of... {% else %} I wanted to reach out because... {% endif %}
How it works: If job_title field contains the word "Manager" (Sales Manager, Product Manager, etc.), shows first message. Otherwise, it shows the second message.
π‘ "contains" is powerful: Matches partial text, so you don't need exact job title strings.
3. Multiple Conditions with Operators
Combine multiple conditions in one tag using "or" and "and" operators.
Example with "or":
{% if type == "freelance" or type == "smb" %} We know it's not easy as a small company {% endif %}
How it works: Shows a message if type = "freelance" OR type = "smb". Either condition triggers the content.
Available operators:
== (equals)
!= (not equals)
or (either condition true)
and (both conditions true)
contains (field contains text)
4. Time-Based Greetings
Send greetings that match the time of day when email arrives.
β οΈ Important: Liquid syntax uses France timezone (server time). Adjust for recipient time zones accordingly.
Morning vs afternoon greeting:
{% assign ampm = "now" | date: "%P" %}{% if ampm contains "am" %}Good morning{% else %}Good afternoon{% endif %}
How it works: Checks if current time is AM or PM, displays appropriate greeting.
Greeting based on specific hour:
{% assign hour = "now" | date: "%H" | plus: 0 %}{% if hour >= 17 %}Write text for past 17:00{% else %}Write text for previous 17:00{% endif %}
How it works: If the time is 5 pm (17:00) or later, it shows the evening message. Before 5 pm shows daytime message.
Time zone adjustments:
Since liquid uses the France timezone, adjust for the recipient's location:
plus: Add hours for time zones ahead of France (Eastern Europe, Asia)
Example:
| plus: 2adds 2 hours
minus: Subtract hours for time zones behind France (Americas)
Example:
| minus: 6subtracts 6 hours
Example for US East Coast (6 hours behind France):
{% assign hour = "now" | date: "%H" | minus: 6 %}{% if hour >= 17 %}Good evening{% else %}Good day{% endif %}
5. Spin Syntax for Message Variations
Create multiple variations of the same content. Each lead receives a randomly selected variation.
Syntax:
{% 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 %}
How it works: Email randomly selects one variation per lead. Adds variety across your campaign so emails don't look identical.
Use cases:
Opening lines
Calls-to-action
Closing sentences
Subject lines
π‘ Prevents pattern detection: If multiple people at the same company receive your emails, spin syntax ensures they don't see identical wording.
6. Dynamic Sending Day
Include the day of the week when the email is sent.
Important syntax change: Replace with {{}}{# #}
Display day of week:
{# "now" | date: "%A" #}
Output: Monday, Tuesday, Wednesday, etc.
Other date formats: Use strftime formatting for different date displays:
%A- Full weekday name (Monday)%a- Abbreviated weekday (Mon)%B- Full month name (January)%d- Day of month (01-31)
Translate days into other languages:
Use "case" statements to display day names in different languages.
Formatting Rules (Critical)
β οΈ Liquid syntax is formatting-sensitive. Improper formatting breaks rendering.
Rules:
Keep syntax on one continuous line
No line breaks within liquid tags
No indentation within syntax
Ensure all brackets are properly opened and closed
β Correct:
{% if variable != blank %} {{ variable }} {% endif %}
β Incorrect (line breaks cause errors):
{% if variable != blank %} {{ variable }} {% endif %}
π‘ Verification: Always check that brackets are paired: every {% has %}, every .{{ has }}
Complete Example Email
Here's a template combining multiple liquid syntax techniques:
{% if gender == "male" %} Dear Mr. {{ lastName }}, {% else %} Dear Ms. {{ lastName }}, {% endif %} {% spin %} {% variation %} I'd love to connect. {% variation %} Let's explore new opportunities together. {% endspin %} Best, {{ sender.name }}
What this does:
Conditional greeting based on gender
Uses
variable{{lastName}}Spin syntax creates two opening line variations
Uses
for signature{{sender.name}}
Best Practices
Preview before sending - Use lemlist's preview panel to verify liquid syntax renders correctly with actual lead data.
Match variable names exactly - Liquid syntax is case-sensitive. "jobTitle" β "jobtitle" β "job_title".
Provide fallbacks - Use {% else %} clauses so emails render properly even when data is missing.
Test with sample leads - Send test emails using leads with different data values to see all variations.
Keep syntax simple - Complex nested conditions are harder to debug. Break into simpler logic when possible.
Verify brackets - Every opening bracket needs a closing bracket. Use a code editor if syntax gets complex.
Use spin syntax strategically - 3-4 variations per spin tag is optimal. Too many variations dilute messaging consistency.
Troubleshooting
Issue: Liquid syntax displays as raw text instead of rendering
Root cause: Syntax error. Missing bracket, incorrect formatting, or line breaks
Fix: Verify all brackets are properly opened/closed. Remove line breaks within liquid tags. Keep syntax on one continuous line.
Issue: Condition not triggering correctly
Root cause: Variable name mismatch or incorrect value comparison
Fix: Check the exact variable name in your lead list (case-sensitive). Verify lead data contains expected values. Preview with the actual lead to test.
Issue: Time-based greeting shows the wrong time
Root cause: Forgot to adjust for the recipient's timezone
Fix: Use plus or minus to adjust from the France timezone to the recipient's timezone. Calculate the hour difference and adjust accordingly.
Issue: Spin syntax shows the same variation for all leads
Root cause: Spin syntax formatted incorrectly or not properly closed
Fix: Verify format: {% spin %} {% variation %} text {% variation %} text {% endspin %}. Each variation needs its own {% variation %} tag.





