- 17 May 2024
- 1 minute read
- Print
- DarkLight
- PDF
Advanced Liquid Markup
- Updated 17 May 2024
- 1 minute read
- Print
- DarkLight
- PDF
Existence Exports
Offload complex comparisons to the query/recipient list as opposed to the mailing by leveraging an existence export. For instance, instead of using this nested Liquid markup:
{% if {{major}} == 'Philosophy'%}{% if {{school_state}} == 'Oregon' or {{address_state}} == 'Connecticut' %}This was tough!{% endif %}{% endif %}
Add an existence export:
Allowing for easier comparison:
{% if {{philosophy_location}} == 'Y' %}Phew! That was much easier!{% endif %}
Checking for Empty or Not Empty Merge Fields
An existence export is ideal for determining if a field is or is not empty. Liquid markup may also be used in this case.
Note: In the syntax below '' is two single quotes with no space between them.
{% if {{major}} == null or {{major}} == '' %}The major field is empty!{% endif %}
{% if {{major}} != null and {{major}} != '' %}The major field is not empty!{% endif %}
Display HTML Content
For HTML data (e.g., an event description), add the "rawhtml" instruction to the Liquid markup merge field to display the output as HTML rather than text.
{{description | rawhtml}}
This instruction is often used in a Liquid loop to display relevant data in a table format. The example below displays the event title, date, and description in a table row for every event returned by the events export or query node.
{% for event in events %}
{{event.title}}
{{event.date}}
{{event.description | rawhtml}}
{% endfor %}