Liquid syntax list

Updated August 19, 2026

You're looking at the latest Liquid documentation

If your account was created on or after Nov 28, 2023, you are using our latest liquid version for all messages. If your account was created before this date, go to How to upgrade your liquid version for more info.

The two versions are largely similar, but you'll find a list of differences on our Liquid Upgrade page.

Customer.io Keys

customer attributes

Syntax
{{customer.<attribute_name>}}
Example
Hi {{ customer.first_name | default: "there" }}

{% if customer.first_name != blank %}
  Hello {{ customer.first_name }}!
{% else %}
  Hello there!
{% endif %}

event properties

Syntax
{{event.<property>}}
Example
{% if event.type == "purchase" %}
  Thanks for your purchase!
{% else %}
  Thanks for using our service!
{%endif%}

event_id

Syntax
{{event_id}}

event_name

Syntax
{{event_name}}

event_timestamp

Syntax
{{event_timestamp}}

journey attributes

Syntax
{{journey.<attribute_name>}}
Example
{% if journey.weather != blank %}
  Here's the forecast for the day: {{journey.weather}}!
{% else %}
  Check out your forecast online at...
{%endif%}

object & relationship attributes

Syntax
{{objects.<object-type-name>[#].<object-attribute-name>}} // reference an object attribute
{{objects.<object-type-name>[#].relationship.<relationship-attribute-name>}} // reference a relationship attribute
{{customer._relationship.<relationship-attribute-name>}} // reference a relationship attribute for the audience member of object or relationship-triggered campaigns
Example
// list all online classes that a person has not started
{% for class in objects.online_classes %}
{% if class.relationship.status == "not_started" %}
  - {{class.name}}
{% endif %}
{% endfor %}

render_liquid

Syntax
{% render_liquid <liquid-key-name>.<attribute_name> %}
Example
{% render_liquid journey.body %}

snippets

Example
{{snippets.footer}}

trigger properties

Syntax
// For transactional messages, webhook-triggered campaigns, or API-triggered broadcasts
{{trigger.<data.property>}}

// For object-triggered campaigns
{{trigger.<object_type>.<attribute_name>}}

// For object or relationship-triggered campaigns
{{trigger.relationship.<attribute_name>}}
Example
{% if trigger.first_name %}
  Hi {{trigger.first_name | capitalize}}!
{% else %}
  Hi friend!
{%endif%}

view_in_browser_url

Syntax
{% view_in_browser_url %}

Customer.io Unsubscribe Keys

manage_subscription_preferences_url

Syntax
{% manage_subscription_preferences_url %}

unsubscribe

Syntax
{% unsubscribe %}

unsubscribe_url

Syntax
{% unsubscribe_url %}

Customer.io Meta Keys

campaign.id

Syntax
{{campaign.id}}

campaign.name

Syntax
{{campaign.name}}

campaign.subscription_topic_ids

Syntax
{{campaign.subscription_topic_ids}}

campaign.type

Syntax
{{campaign.type}}

content

Example
{{content}}

delivery_id

Syntax
{{delivery_id}}

editor

Syntax
{{editor}}

layout.id

Syntax
{{layout.id}}

layout.name

Syntax
{{layout.name}}

message.id

Syntax
{{message.id}}

message.journey_id

Syntax
{{message.journey_id}}

message.name

Syntax
{{message.name}}

message.preheader

Syntax
{{message.preheader}}

message.send_to_unsubs

Syntax
{{message.send_to_unsubs}}

message.subject

Syntax
{{message.subject}}

message.subscription_topic_ids

Syntax
{{message.subscription_topic_ids}}

message.subscription_topic.name

Syntax
{{message.subscription_topic.name}}
{{message.subscription_topic.name | default: "Unsubscribe"}}

message.type

Syntax
{{message.type}}

subscription_topic_name

Syntax
{% subscription_topic_name %}
{% subscription_topic_name lang='pt' %}

Variable Tags

assign

Syntax
{% assign var_name = 'value' %}
Input
{% assign favorite_food = 'apples' %}
Output
{{ favorite_food }}

capture

Input
{% capture about_me %}I am 28 and my favorite food is pasta.{% endcapture %}
Output
{{ about_me }}

Iterative Tags

cycle

Input
<ul>{% assign characters = "coyote,bugs,tweety" | split: "," %}
  {% for character in characters %}
  <li class="{% cycle 'odd', 'even' %}">{{ character }}</li>
  {% endfor %}
</ul>
Output
<ul>
  <li class='odd'>coyote</li>
  <li class='even'>bugs</li>
  <li class='odd'>tweety</li>
</ul>

for loop

Syntax
{% for item in array %}
  {{ item }}
{% endfor %}

{% comment %} You can use a break tag so the loop stops iterating. {% endcomment %}
{% for i in (1..5) %}
  {% if i == 4 %}
    {% break %}
  {% else %}
    {{ i }}
  {% endif %}
{% endfor %}
Example
{% comment %} You can output each item of the array. {% endcomment %}
{% for member in members_of_band %}
  {{member}}
{% endfor %}

{% comment %} If the items are objects, you can output properties from each object. {% endcomment %}
{% for product in event.products %}
  - {{ product.title }} x {{ product.price }}
{% endfor %}

Conditional Tags

case

Syntax
{% case condition %}
  {% when "value1" %}
    text when condition is value1.
  {% when "value2" or "value3" %}
    text when condition is value2 or value3
  {% else %}
    text when condition does not match other conditions
{% endcase %}

if

Example
{% if customer.lastEventType == "sports" %}
  You last attended a sports event, so we thought you might like to try out our leagues! Fill out our interest form below.
{% elsif customer.lastEventType == "theater" %}
  You attended a theater event, so we thought you might like to try out our after show parties! Fill out our interest form below.
{% elsif customer.lastEventType %}
  {% comment %} If the attribute exists and does not equal sports or theater, then this will render.{% endcomment %}
  You last attended {{customer.lastEventType}}; we'd love to hear what other offerings you'd like from us in the form below.
{% else %}
  {% comment %} If the attribute does not exist, this will render. {% endcomment %}
  Let us know your interests in the form below so we can better serve you!
{% endif %}

unless

Example
{% unless product.name == "cool beans" %}
  The beans are not cool.
{% endunless %}

Logical Operators

and

Syntax
{% if condition1 and condition2 %}
  // do something if both condition1 and condition 2 are true
{% endif %}
Example
{% if customer.name == "bugs bunny" and event.episode_start == true %}
  What's up doc?
{% else %}
  That's all folks!
{% endif %}

does not equal (!=)

Example
{% if customer.name != "daffy duck" %}
  Duck season!
{% else %}
  Wabbit season!
{%endif%}

equals (==)

Example
{% if customer.name == "daffy duck" %}
  Wabbit season!
{% else %}
  Duck season!
{% endif %}

greater than and greater than or equal to (>, >=)

Syntax
{% if val1 > val2 %}
  {% comment %}do something if val1 is greater than val2{% endcomment %}
{% endif %}
Example
{% if customer.acct_age_years > 1 %}
  Thanks for being with us these past years
{% else %}
  Thanks for spending the last year with us!
{% endif %}

less than and less than or equal to (<, <=)

Syntax
{% if val1 < val2 %}
  {% comment %}do something if val1 is less than val2{% endcomment %}
{% endif %}
Example
{% if customer.purchases < 5 %}
  Thanks for your support
{% else %}
  Thanks for spending the last year with us!
{% endif %}

or

Syntax
{% if condition1 or condition2 %}
  {% comment %}do something if either condition1 and condition 2 are true{% endcomment %}
{% endif %}
Example
{% if customer.name == "bugs bunny" or customer.group == "looney toons" %}
  That's all folks!
{% else %}
  See you later!
{% endif %}

Timestamps and Dates

add_day

Syntax
{{ <unix_timestamp> | add_day: <int_days> }}
Example
{{ 1477430251 | add_day: 7 }}

add_month

Syntax
{{ <unix_timestamp> | add_month: <int_months> }}
Example
{{ 1477430251 | add_month: 7 }}

add_year

Syntax
{{ <unix_timestamp> | add_year: <int_years> }}
Example
{{ 1477430251 | add_year: 4 }}

countdown

Example
{% countdown point:64 font:roboto weight:light fg:000000 bg:f2f6f9 time:"2022-07-04 12:00:00 (GMT)" locale:en looping:true resolution:S frames:2 %}
countdown

date

Input
{{ 1483272000 | date: '%H:%M, %a, %b %d, %Y' }}
{{ 1483272000 | date: '%a., %-m/%d at %I:%M %P %Z' }}
{{ "1990-12-31T23:00:00Z" | date: "%Y-%m-%dT%H:%M:%S", "Asia/Colombo" }}
{{ "1990-12-31T23:00:00Z" | date: "%Y-%m-%dT%H:%M:%S", 360 }}
Output
12:00, Sun, Jan 01, 2017
Sun., 1/01 at 12:00 pm UTC
1991-01-01T04:30:00
1990-12-31T17:00:00

date_to_long_string

Input
{{ site.time | date_to_long_string }}
{{ site.time | date_to_long_string: "ordinal" }}
{{ site.time | date_to_long_string: "ordinal", "US" }}
Output
07 November 2008
7th November 2008
November 7th, 2008

date_to_rfc822

Input
{{ site.time | date_to_rfc822 }}
Output
Mon, 07 Nov 2008 13:07:54 -0800

date_to_string

Input
{{ site.time | date_to_string }}
{{ site.time | date_to_string: "ordinal" }}
{{ site.time | date_to_string: "ordinal", "US" }}
Output
07 Nov 2008
07th Nov 2008
Nov 7th, 2008

date_to_xmlschema

Input
{{ site.time | date_to_xmlschema }}
Output
2008-11-07T13:07:54-08:00

event_timestamp

Syntax
{{event_timestamp}}

now

Example
{{ 'now' | date: '%I:%M %p %B %d, %Y' }}
{{ 'now' | date: '%s' | plus: 0 | add_day: 1 | date: '%I:%M %p %B %d, %Y'}}
Output
08:28 AM May 11, 2021
08:28 AM May 12, 2021

subtract_day

Syntax
{{ <unix_timestamp> | subtract_day: <int_days> }}
Example
{{ 1477430251 | subtract_day: 7 }}

subtract_month

Syntax
{{ <unix_timestamp> | subtract_month: <int_months> }}
Example
{{ 1477430251 | subtract_month: 2 }}

subtract_year

Syntax
{{ <unix_timestamp> | subtract_year: <int_years> }}
Example
{{ 1477430251 | subtract_year: 4 }}

Array Filters

compact

Input
{{ "mick, keith, nil, Charlie" | compact }}
Output
mick, keith, Charlie

concat

Input
{% assign stones = "mick, keith, ronnie, charlie" | split: ", " %}
{% assign beatles = "john, paul, george, ringo" | split: ", " %}
{% assign rolling_beatles = stones | concat: beatles %}
{{ rolling_beatles | join: ", " }}
Output
mick, keith, ronnie, charlie, john, paul, george, ringo

find

Input
{{ customer.purchases | find: "type", "kitchen" | json }}
Output
{"date":"1726589206","title":"utensils","type":"kitchen"}

find_exp

Input
{{ members | find_exp: "item", "item.graduation_year == 2014" | json }}
Output
{"graduation_year":2014,"name":"John"}

first

Input
acme.characters = ["Wile E Coyote", "Road Runner"]
{{ acme.characters | first }}
Output
Wile E Coyote

group_by

Input
{% assign groups = customer.purchases | group_by: "type" %}

{% for group in groups %}

  {{group.name | capitalize}}

  {% for item in group.items %}

    - {{ item.title }}

  {% endfor %}

{% endfor %}
Output
Bathroom
- shower curtain
- body soap
Kitchen
- forks
- spoons
- knives

group_by_exp

Input
{% assign groups = customer.purchases | group_by_exp: "item", "item.type contains 'kitchen'" %} 

{% for group in groups %}

  {% if group.name == true %}

    You bought some kitchen supplies from us in the past year:

      {% for item in group.items %}

      - {{item.title}}

      {% endfor %}

  {% endif %}

{% endfor %}
Output
You bought some kitchen supplies from us in the past year:
- forks
- spoons
- knives

join

Input
acme.characters = ["Wile E Coyote", "Road Runner"]
{{ acme.characters | join: ', ' }}
Output
Wile E Coyote, Road Runner

json_array_uniq

Input
{{ customer.arrayOfColorObjects | concat: customer.arrayOfColorObjectsWithDuplicationsAndNew | json_array_uniq: 'name' | to_json }}
Output
[{"color":"brown","name":"coyote"},{"color":"black","name":"bugs"},{"color":"yellow","name":"tweety"},{"color":"black","name":"daffy"}]

last

Input
acme.characters = ["Wile E Coyote", "Road Runner"]
{{ acme.characters | last }}
Output
Road Runner

limit

Input
{% assign beatles = "john, paul, george, ringo" | split: ", " %}
{{ beatles | limit: 2 | join: ", " }}
Output
john, paul

map

Input
Array of objects: [{"name":"coyote"},{"name":"bugs"},{"name":"tweety"}]"
{% assign names = customer.characters | map: 'name' %}
Output
coyote, bugs, tweety

pop

Input
{% assign fruits = "apples, oranges, peaches" | split: ", " %}

{% assign everything = fruits | pop %}

{% for item in everything %}
- {{ item }}
{% endfor %}
Output
- apples
- oranges

push

Input
{% assign fruits = "apples, oranges" | split: ", " %}

{% assign everything = fruits | push: "peaches" %}

{% for item in everything %}
- {{ item }}
{% endfor %}
Output
- apples
- oranges
- peaches

remove

Input
{% assign pl = customer.products | remove: customer.products[0] %}
- {{ customer.products.size }}
- {{ pl.size }}
Output
- 2
- 1

reverse

Input
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

{{ my_array | reverse | join: ", " }}
Output
plums, peaches, oranges, apples

shift

Input
{% assign fruits = "apples, oranges, peaches" | split: ", " %}

{% assign everything = fruits | shift %}

{% for item in everything %}
- {{ item }}
{% endfor %}
Output
- oranges
- peaches

size

Input
{{ "That's all, folks!" | size }}
{{ customer.latest_purchase | size }}
{{ objects.online_classes | size }}
{{ objects.online_classes.size }}
Output
18 // The number of characters
4 // If `latest_purchase` is an array, this returns the number of items in the array. Otherwise, it returns a count of characters.
2 // The number of objects (onlines classes) that a person is related to.
2 // Using the size filter with dot notation

sort

Input
{% assign beatles = "paul, john, ringo, george" | split: ", " %}

{{ beatles | sort | join: ", " }}
Output
george, john, paul, ringo

sort_natural

Input
{{ "mick, keith, Charlie, Ronnie" | sort_natural }}
Output
Charlie, keith, mick, Ronnie

sum

Input
{% assign nums = '1,2,3' | split: ',' %}
{{ nums | sum }}

{% assign letters = 'a,b,c' | split: ',' %}
{{ letters | sum }}

{{ cart.products | sum: 'total_number' }} {% comment %} where `total_number` includes milk,cheese,eggs {% endcomment %}

{{ purchase.products | sum }} {% comment %} where `products` includes true,false {% endcomment %}
Output
6
0
3
1 {% comment %} counts the number of trues, would also aggregate numbers alongside booleans {% endcomment %}

uniq

Input
{% assign my_array = '"lions", "tigers", "bears", "bears", "lions"' %}
{{ my_array | uniq | join: ", " }}
Output
lions, tigers, bears

unshift

Input
{% assign fruits = "oranges, peaches" | split: ", " %}

{% assign everything = fruits | unshift: "apples" %}

{% for item in everything %}
- {{ item }}
{% endfor %}
Output
- apples
- oranges
- peaches

where

Input
All Players:
{% for player in customer.players %}
  - {{ player.last_name }}
{% endfor %}

Baseball Players:
{% assign baseball_players = customer.players | where: "sport", "baseball" %}
{% for player in baseball_players %}
  - {{ player.last_name }}
{% endfor %}

----------------------------

All products:
{% for product in customer.products %}
- {{ product.title }}
{% endfor %}

{% assign available_products = customer.products | where: "available" %}

Available products:
{% for product in available_products %}
- {{ product.title }}
{% endfor %}

where_exp

Input
All products:
{% for product in customer.products %}
- {{ product.title }}
{% endfor %}

{% assign kitchen_products = customer.products | where_exp: "item", "item.size > 30 and item.type == 'kitchen'" %}

Kitchen products:
{% for product in kitchen_products %}
- {{ product.title }}
{% endfor %}

where_not

Input
All players:
{% for player in customer.players %}
  - {{ player.last_name }}
{% endfor %}

Not baseball players:
{% assign not_baseball_players = customer.players | where_not: "sport", "baseball" %}
{% for player in not_baseball_players %}
  - {{ player.last_name }}
{% endfor %}
Output
All players:
  - Posey
  - Maradona
  - Montana
  - Gretzky
  - Jordan

Not baseball players:
  - Maradona
  - Montana
  - Gretzky
  - Jordan

Number and Currency Filters

A list of locales and currency codes

abs

Input
{{ 3.14 | abs }}
Output
3.14

ceil

Input
{{ 3.14 | ceil }}
Output
4

currency

Input
{% comment %} no arguments: {% endcomment %}
  {{ 1234567.896 | currency }}
{% comment %} only locale: {% endcomment %}
  {{ 1234567.896 | currency: 'en-GB' }}
{% comment %} locale and currency code: {% endcomment %}
  {{ 1234567.896 | currency: 'en', 'EUR' }}
Output
$1,234,567.90
£1,234,567.90
€1,234,567.90

floor

Input
{{ 3.14 | floor }}
Output
3

format_number

Input
{{ 10000 | format_number }}
{{ 123456.78 | format_number: "fr" }}
Output
10,000
123 456,78

random

Example
{% random 100 %}

round

Input
{{ 4.32 | round }}
{{ 4.32 | round: 1 }}
Output
4
4.3

rounded_currency

Input
{% comment %} no arguments: {% endcomment %}
  {{ 1234567.896 | rounded_currency }}
{% comment %} only locale: {% endcomment %}
  {{ 1234567.896 | rounded_currency: 'en-GB' }}
{% comment %} locale and currency code: {% endcomment %}
  {{ 1234567.896 | rounded_currency: 'en', 'EUR' }}
Output
$1,234,568
£1,234,568
€1,234,568

Math Filters

at_least

Input
{{ 41 | at_least: 42 }}
Output
42

at_most

Input
{{ 100 | at_most: 99 }}
Output
99

divided_by

Input
{{ 10 | divided_by: 2.5 }}
{{ 10 | divided_by: 4 }}
{{ 10 | divided_by: 4.0 }}
Output
4
2.5
2.5

minus

Input
{{ 10 | minus: 1 }}
Output
9

modulo

Input
{{ 3 | modulo: 2 }}
Output
1

plus

Input
{{ 10 | plus: 1 }}
Output
11

times

Input
{{ 5 | times: 2 }}
{{ 10 | times: 2.5 }}
Output
10
25

String Filters

append

Input
{{ "What's all the hubbub, " | append: "bub?" }}
Output
What's all the hubbub, bub?

array_to_sentence_string

Input
{{ customer.groceries | split:"," | array_to_sentence_string }}
{{ customer.groceries | split:"," | array_to_sentence_string: "or" }}
Output
cherry, kiwi, and passion fruit
cherry, kiwi, or passion fruit

base64

Input
{{ 'Hello, world!' | base64 }}
Output
SGVsbG8sIHdvcmxkIQ==

base64_decode

Input
{{ "Zm9vLmJhcg==" | base64_decode }}
Output
foo.bar

base64_encode

Input
{{ "foo.bar" | base64_encode }}
Output
Zm9vLmJhcg==

base64_url_safe_decode

Input
{{ "Zm9vLmJhcg" | base64_url_safe_decode }}
Output
foo

base64_url_safe_encode

Input
{{ "foo" | base64_url_safe_encode }}
Output
Zm9vLmJhcg

capitalize

Input
{{ "hello world" | capitalize }}
Output
Hello world

cgi_escape

Input
{{ "overview: account" | cgi_escape }}
Output
overview%3A+account

contains

Syntax
{% if product.description contains 'lorem ipsum' %}
  You might also be interested in Fillerama or Office Ipsum.
{% endif %}

downcase

Syntax
{{ 'STRING' | downcase }}
Input
{{ "ACME" | downcase }}
Output
acme

escape

Input
{{ "win+help@customer.io" | escape }}
Output
win%2Bhelp%40customer.io

escape_once

Input
{{ "1 < 2 & 3" | escape_once }}
Output
1 < 2 & 3

hex_base64

Input
{{ "Customer.io" | hmac_sha256: "some_key" | hex_base64 }}
Output
bd23cyOCFrzicxM7w/ahKoJPQd0YTQlFLwXHZZ2ufVc=

hmac_sha1

Input
{{ "Customer.io" | hmac_sha1: "some_key" }}
Output
2bdf556c9a75766f258d1e2824f6d0e31d1beedc

hmac_sha256

Input
{{ "Customer.io" | hmac_sha256: "some_key" }}
Output
6dddb773238216bce273133bc3f6a12a824f41dd184d09452f05c7659dae7d57

lstrip

Input
text{{ " Customer.io " | lstrip }}text
Output
textCustomer.io text

md5

Input
{{ "Customer.io" | md5 }}
Output
d52b6a207bf5255c05b1d0056230617e

newline_to_br

Input
<br />
Customer.io<br />
liquid<br />

normalize_whitespace

Input
{{ "a \n b" | normalize_whitespace }}
Output
a b

number_of_words

Input
{{ "Welcome to Customer.io!" | number_of_words }}
Output
3

pluralize

Syntax
{{ int-val | pluralize: 'singular', 'plural'}}
Input
{{ event.item_count | pluralize: 'item', 'items' }}
Output
3 items

prepend

Input
{{ "Sufferin' succotash!" | prepend: "Sylvester: " }}
Output
Sylvester: Sufferin' succotash!

remove_first

Input
{{ "folks that's all, folks!" | remove_first: "folks" }}
Output
that's all folks!

remove_last

Input
{{ "foobarbar" | remove_last: "bar" }}
Output
foobar

remove

Input
{{ "And that's all, folks!" | remove: ", folks" }}
Output
And that's all!

replace

Syntax
{{ "String you want to replace values in" | replace: "find-str", "replace-str" }}
Input
{{ "Coyotes never catch roadrunners!" | replace: "never", "always" }}
Output
Coyotes always catch roadrunners!

replace_first

Syntax
{{ "String you want to replace values in" | replace_first: "find-str", "replace-str" }}
Input
{{ "roller rocket roller skates" | replace_first: "roller", "awesome" }}
Output
awesome rocket roller skates

replace_last

Input
{{ "foobarbar" | replace_last: "bar", "foo" }}
Output
foobarfoo

rstrip

Input
text{{ " Customer.io " | rstrip }}text
Output
text Customer.iotext

sha1

Input
{{ "Customer.io" | sha1 }}
Output
c197ff0ae0a41983362f35ca972c544061c54d4c

sha256

Input
{{ "Customer.io" | sha256 }}
Output
6dddb773238216bce273133bc3f6a12a824f41dd184d09452f05c7659dae7d57

slice

Syntax
{{ "string" | slice: <req, index of char>, <optional, length of result> }}
Input
{{ "Customer.io" | slice: 3 }}
{{ "Customer.io" | slice: 3, 3 }}
{{ "Customer.io" | slice: '-4', 3 }}
Output
t
tom
r.i

slugify

Input
{{ "The _config.yml file" | slugify }}

{{ "The _config.yml file" | slugify: "pretty" }}

{{ "The _cönfig.yml file" | slugify: "ascii" }}

{{ "The cönfig.yml file" | slugify: "latin" }}

{{ "The cönfig.yml file" | slugify: "latin", true }}
Output
the-config-yml-file

the-_config.yml-file

the-c-nfig-yml-file

the-config-yml-file

The-config-yml-file

split

Input
{% assign rolling_stones = "Mick, Keith, Ronnie, Charlie" | split: ", " %}

{% for member in rolling_stones %}
  {{ member }}
{% endfor %}

strip

Input
text{{ " Customer.io " | strip }}text
Output
Customer.io

strip_html

Input
{{ "Eh, what's <i>up</i>, <b>Doc</b>?" | strip_html }}
Output
Eh, what's up, Doc?

strip_newlines

Example
{{ product.description | strip_newlines }}

titlecase

Syntax
{{ 'string' | titlecase }}
Input
{{ "rocket roller skates" | titlecase }}
Output
Rocket Roller Skates

truncate

Input
{{ "I knew I shoulda taken that left turn at Albuquerque." | truncate: 20 }}
Output
I knew I shoulda ...

truncatewords

Input
{{ "I knew I shoulda taken that left turn at Albuquerque." | truncatewords: 8 }}
Output
I knew I shoulda taken that left turn...

upcase

Syntax
{{ 'string' | upcase }}
Input
{{ 'acme' | upcase }}
Output
ACME

uri_escape

Input
{{ "https://example.com/?q=foo, \bar?" | uri_escape }}
Output
https://example.com/?q=foo,%20%08ar?

url_decode

Input
{{ "%27Customer.io+is+great%27" | url_decode }}
Output
Customer.io is great

url_encode

Input
{{ "cool.person@example.com" | url_encode }}
Output
cool.person%40example.com

xml_escape

Input
{{ "Have you seen \'Learn the basics: video guide\'?" | xml_escape }}
Output
Have you read &#39;James &amp; the Giant Peach&#39;?

Miscellaneous

comment

Syntax
{% comment %} Don't display me! {% endcomment %}

default

Example
{{ product_color | default: "red" }}
{{ product_price | default: 2.99 }}

from_json

Example
{% assign var = '{"key": "value", "number": 123, "boolean": true}' | from_json %}
{{ var.key }}
{{ var.number }}
{{ var.boolean }}
Input
{% assign fruit = '{"type": "kiwi", "quantity": 2, "sweet": true}' | from_json %}
{{ fruit.type }}
{{ fruit.quantity }}
{{ fruit.sweet }}

{% assign greeting = '[{"greeting": "hello" }, {"greeting": "hey" }, {"greeting": "hi" }, {"greeting": "howdy" }]' | from_json %}
{{ intro[0].greeting }}
{{ intro[1].greeting }}
{{ intro[2].greeting }}
{{ intro[3].greeting }}
Output
kiwi
2
true

hello
hey
hi
howdy

generate_uuid

Example
{% generate_uuid %}

json

Input
{% assign arr = "foo bar coo" | split: " " %}
{{ arr | json: 4 }}
Output
[
  "foo",
  "bar",
  "coo"
]

raw

Example
{% raw %}
  {{This}} is displayed exactly as typed.
{% endraw %}

to_json

Example
{{ customer | to_json }}

whitespace control

Input
{% assign username = "Charlie" %}
Hello, {{ username -}} !
Output
Hello, Charlie!