Using liquid tags for personalization

Intempt uses an open source templating language called Liquid to reference and create personalized content. The Liquid template language provides logical operators to control how you want to include user, product and recommendation content in your templates. You can use Liquid template language to personalize the content of the templates. For emails, you can also personalize the subject line and preheader of the email. 

About Liquid

Liquid templating language supports the use of objects, tags, and filters.

  • Objects allow you to insert personalized attributes into your messages.
  • Tags allow you to execute programming logic in your messages. For example, you can use tags to include intelligent logic, such as “if” statements, in your campaigns.
  • Filters allow you to reformat personalized attributes and dynamic content. For example, you could convert a timestamp, such as 2022-09-07 08:43:50 UTC, into a date, such as September 7, 2022.

Terms to know

These terms are based on Shopify’s documentation.

TERMDEFINITIONEXAMPLE
LiquidAn open-source, customer-facing template language created by Shopify and written in Ruby; used to load/pull dynamic content.{{attribute.first_name}} will insert a user’s first name into a message.
ObjectA denotation of a variable and location of intended variable name that tells Liquid where to show content in the message.{{${first_name}}} will insert a user’s first name into a message.
Conditional Logic TagTags create logic and control the flow for templates. In Intempt’s case, Conditional Logic Tags are Liquid used to consider intelligent or programming logic to create exceptions and variations in messages based on certain, predefined criteria.{% if ${language} == 'en' %} will trigger your message in a designated way in the event that a user has designated “English” as their language.
FiltersUsed to change, narrow, or reformat the output of the Liquid Object. It is often used to create mathematical operations.{{"Big Sale" | upcase}} will cause the words “Big Sale” to appear as “BIG SALE” in the message.
OperatorsUsed in messages to create dependencies or criteria that can affect which message your user receives.Is a user meets the defined criteria in a messaged tagged with {% attribute.${Total_Revenue} > 0%}, they will receive the message. If not, they will receive another designated message (or not), depending on what you set.

Liquid personalization variables

While you can access a lot of information with Liquid, there are generally three types of variables you’ll mainly use to personalize messages for your audience: user attributes, account attributes, and products.

User attributes 

The user attribute scope represents attributes associated with customers. You can reference customer variables in any message or action except when working with anonymous users. User attributes can only be created for attributes that have user identifiers associated with them.

Input:

{{attribute.user.first_name} 

Output

John

Account attributes 

Account attributes use the account scope - that means the information is associated with account or company data. Account attributes can only be created for attributes that have account identifiers assigned.

Input

{{attribute.account.company_name}}

Output

Intempt technologies

Products will use any product data collected/ingested via Intempt. This can include product catalog data and any collected data item. With collection properties, you can reference catalog variables such as product name, image, URL, and other objects (product. Product data can be accessed only for collections that have product identifiers assigned.

Input

{{product[0].product_catalog.product_name}}

Output

Nike shoes

Liquid Fallbacks

Messages will fail if you attempt to use data that does not exist—like when person doesn’t have an attribute or an event doesn’t have a property you reference. To prevent this kind of error, you should implement an if statement to fallback to a static value when a variable (attribute, event property, etc) doesn’t exist.

You can write your own fallback statements using liquid

For example, a subset of people have a value for an attribute named plan_name, you could create a fall back like this:

{% if attribute.user,plan_name != blank %}   You are currently on our {{ attribute.user.plan_name | capitalize }} plan. {% else %}   Please choose a plan. {% endif %}

That will show, "You are currently on our XYZ plan." for customers who have a value for their plan_name attribute and "Please choose a plan." for customers who do not have a value for their plan_name attribute.

Alternatively, if you would rather not show anything for People who do not have a value for their plan_name attribute you can just leave off the else statement like this:

Copy

{% if attribute.plan_name != blank %}   You are currently on our {{ atribute.user.plan_name | capitalize }} plan. {% endif %}

That will show, "You are currently on our XYZ plan." for customers who have a value for their plan_name attribute and nothing at all for People who do not have a value for their plan_name attribute.

Filters and tags

Filters and tags make up the foundations of Liquid, and there are a number of them that you can use. In the first-name example, if you wanted to make sure it was capitalized, add a capitalize filter to the tag:

{{ customer.first_name | capitalize }}

If the field was full_name and you wanted to include only the first word/name, you could use:

{{ customer.full_name | split: " " | first }}

Check out the other filters and tags (and how to write them) in the complete Liquid documentation by Shopify.

More examples: what else can you do?

Note: If you are using our drag-and-drop email editor to add user data, if you have code which involves logical or comparison operators (&, >, or <), use our “Add Liquid” option in the text dropdown, rather than typing manually:

Countdown to an event

If your customers subscribe to an event—a webinar, they buy tickets to a movie or concert, etc—you can include a countdown to an event or specific date and time that your audience is interested in!

Copy

{% 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 timer result

Countdown timers take several parameters. Your timer must include the font size, the foreground (font) color, the background color, and the time you want to count down to.

Parameterrequiredformatdefaultdescription
pointintegerThe font size for the timer
timeISO 8601 timestampThe date and time you want to countdown to in the format YYYY-MM-DD hh:mm:ss (TZ). Remember to close the time in quotes, as the value includes a space.
fghex colorThe foreground (font) hexidecimal color
bghex colorThe background hexidecimal color
fontstringinter, robotoThe font family for your timer
weightstringnormalThe font weight, takes normal CSS font-weight values.
localelanguage codeenThe language you want to display: en (English), ru (Russian), jp (Japanese), zh (Chinese), pt (Portugese), es (Spanish)
loopingbooleanfalseDetermines whether the countdown timer should restart after it finishes
resolutionone of S, M, H, DSDetermines how often the timer counts down—by the second, minute, hour, or day.
framesinteger1Number of seconds you want to show, based on the resolution, where seconds: 60, minutes: 2, hours: 1, days: 1

Math operations with attributes

Attributes are stored as strings—even if the attribute value is a number or an integer. When you want to use a number/integer attribute in a math operation, or evaluate it against another number, you need to convert the attribute to a number/integer to ensure that your liquid statements evaluate properly. You can do this using plus to add zero to the attribute.

Copy

{% assign my_attribute = customer.my_attribute | plus: 0 %}

{% if my_attribute > 0 %}

  Your attribute is greater than 0!

{% else %}

  Oh no, your attribute is 0 or negative.

{% endif %}

Links

You can include attributes within links as well, in order to send your users to a custom page.

Example:

Copy

Displaying a timestamp as a regular date

Let’s say you have a customer attribute called expiration (for a trial, maybe) that you store as a timestamp. If you wanted to display that expiration date in messages as a human-readable date, you can do so with liquid. There are a few different date filters you can use with this, but here we’re just going to show you month name, day, and year.

Example

If you had a customer attribute called expiration with a timestamp value of 1596153600, you can do the following:

{{user.attriute.expiration| date: "%B %-d, %Y"}}

The result in your message would be July 31, 2022.

The spaces, commas, etc between the date filters are included in the output. So if you want 31/07/2022 you’d do %d/%m/%Y.

For the current date, you can use:

{{ 'now' | date: "%B %-d, %Y" }}

Displaying how many days left in a trial

{% assign current_date = 'now' | date: '%s' %} {% assign future_date = user.attribute.trial_end %} {{ assign. user.attribute.future_date | minus: current_date | divided_by: 86400 }}

Explanation

  1. You can get the current epoch time with 'now' | date: "%s". %s is a formatting option.
  2. The customer.trial_end date is in epoch time.
  3. Since epoch time is in seconds, we’re dividing by 86400 (number of seconds in a day) to get the number of days. Keep in mind that this is integer division so it’ll be rounded down.

Localizing date

If you want to display the current date formatted like: 06:54 AM Février 21, 2017 you can use this code replacing the months with the proper names for your desired lanuage:

{{'now' | date: "%H:%M %p %B %d, %Y" | replace: "January","Janvier" | replace: "February","Février" | replace: "March","Mars" | replace: "April","Avril" | replace: "May","Mai" | replace: "June","Juin" | replace: "July","Juillet" | replace: "August","Aout" | replace: "September","Septembre" | replace: "October","Octobre" | replace: "November","Novembre" | replace: "December","Décembre"}}

Show a different message based on day of week

{% assign day = 'now' | date: '%A' %} {% if day == 'Friday' %} Have a great weekend! {% else %} Cheers, {% endif %}

Using data containing whitespace

We recommend adding data to Customer.io without spaces. But if you do (for example, if you send us an attribute called current city), here’s how you’d refer to it:

{{ customer["current city"] }}

Filtering out default data or specific data

Copy

{% if customer.first_name contains 'Visitor' %}

{% else %}{{ customer.first_name | capitalize }}

{% endif %}

Full Liquid tag glossary

Logical Operators

Logical operators determine the basic rules for evaluating true or false statements. You can also use `and` and `or` operators to combine logic statements to evaluate multiple conditions.

andEvaluate a statement as true when both conditions are true.
Syntax{% if condition1 and condition2 %}

  // do something if both condition1 and condition 2 are true

{% endif %}

Example

    {% if attribute.user.name == "bugs bunny" and event.episode_start == true %}

      What's up doc?

    {% else %}

      That's all folks!

    {% endif %}

Does not equal (!=)Use != to check that two values are not equal to each other.
Example{% if attribute.user.name != "daffy duck" %}

  Duck season!

{% else %}

  Wabbit season!

{%endif%}

equals (==)Use == to check if two values are equal to each other.
Example{% if attribute.user.name == "daffy duck" %}

  Wabbit season!

{% else %}

  Duck season!

{%endif%}

Greater than and Greater than or equal to (>, >=)Use > to match when one value is greater than another. Use >= to match when one value is greater than or equal to another.
Syntax{% if val1 > val2 %}

  // do something if val1 is greater than val2

{% endif %}

Example

    {% if attribute.user.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 (<, <=)Use < to match when one value is less than another. Use <= to match when one value is less than or equal to another.
Syntax{% if val1 < val2 %}

  // do something if val1 is less than val2

{% endif %}

Example

    {% if attribute.user.purchases < 5 %}

      Thanks for your support

    {% else %}

      Thanks for spending the last year with us!

    {% endif %}

orEvaluate a statement as true when either of two conditions are true.
Syntax{% if condition1 or condition2 %}

  // do something if either condition1 and condition 2 are true

{% endif %}

Example

    {% if attribute.user.name == "bugs bunny" or attribute.user.group == "looney toons" %}

      That's all folks!

    {% else %}

      See you later!

    {% endif %}

Loops and Conditionals

Loop through an array of items or set conditions determining the content that you want to show.

  • caseCreates a set of conditions depending on a variable’s specific value—like a set of if, if-else, else conditions.
    For example, you might use this to display different text depending on if a attribute.user lives in a specific country.
    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 %}

for loopRepeatedly executes a block of code, most commonly to perform an operation for each item in an array. You might use a for loop in a message to provide a receipt of purchases (assuming an array of items in a purchase). Find more information about for loops and iteration here.Syntax{% for item in array %}

  {{ item }}

{% endfor %}

Example

    // You can output each item of the array

    {% for member in members_of_band %}

      {{member}}

    {% endfor %}

    // If the items are objects, you can output properties from each object

    {% for product in event.products %}

      - {{ product.title }} x {{ product.price }}

    {% endfor %}

ifExecutes a block of code if a condition is met. Use elsif to add multiple ‘if’ conditions and else for the block of code you want to execute if all conditions are false. Find more information about conditional liquid here.
Example{% if attribute.user.name == "chad" %}

  Hey Chad!

{% elsif attribute.user.name != "chad" %}

  Hey {{ attribute.user.name | capitalize }}!

{% else %}

  Hi Buddy!

{% endif %}

unlessLike an if conditional, but reversed: this tag executes a block of code if your condition is not met.
Example{% unless product.name == "cool beans" %}

  The beans are not cool.

{% endunless %}

Timestamps and Dates

Use these tags to get and manipulate dates and times.

add_dayAdds a day, or multiple days, to a given timestamp.
Syntax{{ <unix_timestamp> | add_day: <int_days> }}

Example

    {{ 1477430251 | add_day: 7 }}

add_monthAdds a month, or multiple months, to a given timestamp.
Syntax{{ <unix_timestamp> | add_month: <int_months> }}

Example

    {{ 1477430251 | add_month: 7 }}

add_yearAdds a year, or multiple years, to a given timestamp.
Syntax{{ <unix_timestamp> | add_year: <int_years> }}

Example

    {{ 1477430251 | add_year: 4 }}

dateFormat a date. Use the Ruby syntax reference for more information about date formatting syntax.
Input{{ 1483272000 | date: '%H:%M, %a, %b %d, %Y'}}

Output

    12:00, Sun, Jan 01, 2017

event_timestampThe UNIX timestamp when a particular event was performed. This time is different from now!
Syntax{{event_timestamp}}

nowThe current time in UTC. You must format time with date.
To modify date or time with add or subtract filters you must convert now into a unix timestamp first using date: '%s'. If you use our built in add_day, add_month, or add_year filters, you must convert the timestamp to an integer first. You can do this by using the plus filter to add 0 as shown in the second example below.
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_daySubtracts a day, or multiple days, to a given timestamp.
Syntax{{ <unix_timestamp> | subtract_day: <int_days> }}

Example

    {{ 1477430251 | subtract_day: 7 }}

subtract_monthSubtracts a month, or multiple months, to a given timestamp.
Syntax{{ <unix_timestamp> | subtract_month: <int_months> }}

Example

    {{ 1477430251 | subtract_month: 2 }}

subtract_yearSubtracts a year, or multiple years, to a given timestamp.
Syntax{{ <unix_timestamp> | subtract_year: <int_years> }}

Example

    {{ 1477430251 | subtract_year: 4 }}

timezoneConverts a timestamp to a timezone you specify. You can use now instead of a timestamp. Timezone inputs can be -3 (specify your number) or UTC
Example{{ 1483272000 | timezone: '-8' | date: '%H:%M, %a, %b %d, %Y'}}

Output

    04:00, Sun, Jan 01, 2017

Array Filters

Liquid used to filter and manipulate arrays (lists of values). If your event or another incoming value is an array, you may iterate over the array with a `for` loop or grab items at a particular index of the array, to display information for your audience.

compactRemoves nil (empty) values from an array.
Input{{ "mick, keith, nil, Charlie" | compact }} 

Output

    mick, keith, Charlie

concatConcatenates arrays, joining them end to end. The resulting array contains all of the elements of both original arrays. concat does not remove duplicate entries unless you also use the uniq filter.
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

cycleIn a ‘for’ loop, this tag loops through and outputs strings in the order they were passed.
Input

    {% assign attribute.user.characters = ["coyote","bugs","tweety"] %} {% for character in attribute.user.characters %} 

  • {{ character }}
  •  

    {% endfor %}

Output

    

     

          

  • coyote
  •       

  • bugs
  •  

          

  • tweety
  •  

        

firstReturns the first element of the array.
Inputacme.characters = ["Wile E Coyote", "Road Runner"]

{{ acme.characters | first }}

Output

    Wile E Coyote

joinJoins the elements of an array with the character passed as the parameter.
Inputacme.characters = ["Wile E Coyote", "Road Runner"] 

{{ acme.characters | join: ', ' }}

Output

    Wile E Coyote, Road Runner

lastReturns the last element of the array.
Inputacme.characters = ["Wile E Coyote", "Road Runner"]

{{ acme.characters | last }}

Output

    Road Runner

limitReturn a set number of values from an array or string.
Input{% assign beatles = "john, paul, george, ringo" | split: ", " %} 

{{ beatles | limit: 2 | join: ", " }}

Output

    john, paul

mapCreates an array of values by extracting the values of a property in an object. You can output your new characters in a ‘for’ loop.
InputArray of objects: [{"name":"coyote"},{"name":"bugs"},{"name":"tweety"}]"

{% assign names = attribute.user.characters | map: 'name' %}

Output

    coyote, bugs, tweety

removeRemove an element from an array. The array can contain objects of any type.
Input{% assign pl = collection.products | remove: collection.products[0] %}

- {{ collection.products.size }}

- {{ pl.size }}

Output

    - 2 

    - 1

sizeReturns the number of characters (the size) of a string (in characters) or the number of elements in an array.
Input{{ "That's all, folks!" | size }}

Output

sortSorts the elements of an array by an attribute of an element in that array. Usually used with a ‘for’ loop. The order of the sorted array is case-sensitive!
Input{% assign beatles = "paul, john, ringo, george" | split: ", " %}

{{ beatles | sort | join: ", " }}

Output

    george, john, paul, ringo

sort_naturalSort the items in an array in case-insensitive order.
Input{{ "mick, keith, Charlie, Ronnie" | sort_natural }}

Output

    Charlie, keith, mick, Ronnie

uniqRemoves duplicate elements in an array.
Input{% assign my_array = '"lions", "tigers", "bears", "bears", "lions"' %}

{{ my_array | uniq | join: ", " }} 

Output

    lions, tigers, bears

whereCreates an array including only the objects with a given property value, or any “truthy” value by default. When using where, you provide two items separated by a comma: the key you want to match on and the value you want to match.
InputAll Players:

{% for player in collection.players %} 

  - {{ player.last_name }} 

{% endfor %} 

Baseball Players:

{% assign baseball_players = collection.players | where: "sport", "baseball" %} 

{% for player in baseball_players %} 

  - {{ player.last_name }} 

{% endfor %}

Output

    All Players: 

      - Posey 

      - Lincecum 

      - Montana 

      - Rice 

    Baseball Players: 

      - Posey 

      - Lincecum

where_notCreates an array of items that do not match a given property value, or any “falsey” value by default. When using where_not, you provide two items separated by a comma: the key you want to match on and the value you want to match.

InputAll players: 

{% for player in collection.players %} 

  - {{ player.last_name }} 

{% endfor %} 

Not baseball players: 

{% assign not_baseball_players = collection.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

These are tags and filters that manipulate incoming number, integer, and timestamp values.

Some tags, like the `currency` and `format_number`, take an optional localization parameter, formatting the output for a specific locale. These tags use the format `{{ 10 | currency: "en-us" }}`, which would output `$10.00`.

We support the following localization values:

    af, ar, az, be, bg, bn, bs, ca, cs, cy, da, de, de-AT, de-CH, de-DE, el, el-CY, en, en-AU, en-CA, en-GB, en-IE, en-IN, en-NZ, en-US, en-ZA, en-CY, en-TT, 

    eo, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, et, eu, fa, fi, fr, fr-CA, fr-CH, fr-FR, gl, he, 

    hi, hi-IN, hr, hu, id, is, it, it-CH, ja, ka, km, kn, ko, lb, lo, lt, lv, mk, ml, mn, mr-IN, ms, nb, ne, nl, nn, oc, or, pa, pl, pt, pt-BR, rm, ro, ru, 

    sk, sl, sq, sr, st, sw, ta, te, th, tl, tr, tt, ug, ur, uz, vi, wo, zh-CN, zh-HK, zh-TW, zh-YUE

absReturns the absolute value of a number.
Input{{ 3.14 | abs }}

Output

    3.14

ceilRounds a number up to the nearest integer.
Input{{ 3.14 | ceil }}

Output

    4

currencyConverts an integer to currency. This filter can also take an optional localization parameter to format currency for a specific locale.
Input{{ 10 | currency }}

{{ 123456.78 | currency: "fr" }}

##### Output

    $10.00

    123 456,78€

floorRounds a number down to the nearest integer.
Input{{ 3.14 | floor }}

Output

format_numberFormat a number with a delimiter. This filter also takes an optional localization parameter to format a number for a specific locale.
NOTE: This replaces the former number_with_delimeter filter.
Input{{ 10000 | format_number }}

{{ 123456.78 | format_number: "fr" }} 

Output

    10,000

    123 456,78

randomGenerates a random number between 0 and an integer you specify.
Example{% random 100 %}

roundRounds a number up or down to the nearest integer, or to a decimal place you specify.
Input{{ 4.32 | round }} 

{{ 4.32 | round: 1 }}

Output

    4

    4.3

rounded_currencyRounds a number into the nearest whole integer and formats it to a currency. For exapmle, You cannot use the locale: option with _rounded_currency_ like you can with the standard currency filter.
Input{{ 3.1415 | rounded_currency }}

Output

    $3

to_jsonOutputs the json representation of the input. For example, {{ attribute.user | to_json }} sends all your attribute.user data into a JSON variable.
Example{{ attribute.user | to_json }}

Math Filters

Filters that perform math operations on incoming number or integer values.

at_leastLimits a number to a minimum value.
Input{{ 41 | at_least: 42 }}

Output

    42

at_mostLimits a number to a maximum value.
Input{{ 100 | at_most: 99 }}

Output

    99

divided_byDivides a number by another number.
Input{{ 10 | divided_by: 4 }}

{{ 10 | divided_by: 4.0 }}

Output

    2

    2.5

minusSubtracts a number from another number.
Input{{ 10 | minus: 1 }}

Output

    9

moduloReturns the remainder of division.
Input{{ 3 | modulo: 2 }}

Output

    1

plusAdds a number to another.
Input{{ 10 | plus: 1 }}

Output

    11

timesMultiplies a number by another number.
Input{{ 5 | times: 2 }}

Output

    10

String Filters

The following filters manipulate strings in templates. You might use these to truncate or set the case of strings you reference from other places, to humanize your messages for recipients.

appendAdds a string to the end of another string.
Input{{ "What's all the hubbub, " | append: "bub?" }}

Output

    What's all the hubbub, bub?

base64Base64-encodes a string.
Input{{ 'Hello, world!' | base64 }}

Output

    SGVsbG8sIHdvcmxkIQ==

base64_decodeDecode a base64-encoded string.
Input{{ "Zm9vLmJhcg==" | base64_decode }}

Output

    foo.bar

base64_encodeBase64-encode a value.
Input{{ "foo.bar" | base64_encode }}

Output

    Zm9vLmJhcg==

base64_url_safe_decodeDecode a string from URL-safe Base64.
Input{{ "Zm9vLmJhcg" | base64_url_safe_decode }}

Output

    foo

base64_url_safe_encodeEncode a string into URL-safe Base64. To produce URL-safe Base64, this filter uses - and _ in place of + and /.
Input{{ "foo" | base64_url_safe_encode }}

Output

    Zm9vLmJhcg

capitalizeCapitalize the first character in a string.
Input{{ "hello world" | capitalize }}

Output

    Hello world

containsFinds a substring inside a string, or the presence of a string in an array of strings. This filter only works with strings; you cannot use it to search for an object in an array of object.
Syntax{% if product.description contains 'lorem ipsum' %}

  You might also be interested in Fillerama or Office Ipsum.

{% endif %}

downcaseConverts a string to lower case.
Syntax{{ 'STRING' | downcase }}

Input

    {{ "ACME" | downcase }}

Output

    acme

escapeEscaping (or encoding) a string removes special characters.
Input{{ "[email protected]" | escape }}

escape_onceEscapes or encodes a string, but doesn’t include already-escaped characters.
Input{{ "1 < 2 & 3" | escape_once }}

Output

    1 < 2 & 3

hex_base64Returns a base64 encoding of a hex digest, like ones returned by the hmac_sha256 filter.
Input{{ "Intempt.com" | hmac_sha256: "some_key" | hex_base64 }}

Output

    bd23cyOCFrzicxM7w/ahKoJPQd0YTQlFLwXHZZ2ufVc=

hmac_sha1Converts a string into an hmac_sha1 hash.
Input{{ "Intempt.com" | hmac_sha1: "some_key" }}

Output

    2bdf556c9a75766f258d1e2824f6d0e31d1beedc

hmac_sha256Converts a string into an hmac_sha256 hash.
Input{{ "Intempt.com" | hmac_sha256: "some_key" }}

Output

    6dddb773238216bce273133bc3f6a12a824f41dd184d09452f05c7659dae7d57

htmlencodeEscapes HTML characters into HTML entities.

lstripStrips all whitespace, including tabs, spaces, and newlines, from the left side of a string.
Inputtext{{ " Intempt.com " | lstrip }}text

Output

    textIntempt.com text

md5Converts a string into an md5 hash.
Input{{ "Intempt.com" | md5 }}

Output

    d52b6a207bf5255c05b1d0056230617e

newline_to_brReplaces newline with an HTML line break. input: See this example for output.
Input

Intempt.com

liquid

prependAdds a string to the beginning of another string.
Input{{ "Sufferin' succotash!" | prepend: "Sylvester: " }}

Output

 Sylvester: Sufferin' succotash!

remove_firstRemoves the first occurrence of a value from a string.
Input{{ "folks that's all, folks!" | remove_first: "folks" }}

Output

    that's all folks!

remove_lastRemove the last occurence of a string within a substring.
Input{{ "foobarbar" | remove_last: "bar" }}

Output

    foobar

replaceFind and replace values within a string. The first argument represents the value you want to replace, and the second argument is the replacement.
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_firstFind and replace the first match in a string. The first argument represents the value you want to replace, and the second argument is the replacement.
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_lastReplace the last occurence of a string within a substring.
Input{{ "foobarbar" | replace_last: "bar" "foo" }}

Output

    foobarfoo

rstripStrips all whitespace, including tabs, spaces, and newlines, from the right side of a string.
Inputtext{{ " Intempt.com " | rstrip }}text

Output

    text Intempt.comtext

sha1Converts a string into a sha1 hash.
Input{{ "Intempt.com" | sha1 }}

Output

    c197ff0ae0a41983362f35ca972c544061c54d4c

sha256Converts a string into a sha256 hash.
Input{{ "Intempt.com" | sha256 }}

Output

    6dddb773238216bce273133bc3f6a12a824f41dd184d09452f05c7659dae7d57

sliceReturns the character located at the index specified in the first argument. You can also provide a second argument indicating the length of the string you want to return (if you want to return multiple characters).
If the first argument is a negative number, the index is begins from the end of the string.
Syntax{{ "string" | slice: <req, index of char>, <optional, length of result> }}

Input

    {{ "Intempt.com" | slice: 3 }}

    {{ "Intempt.com" | slice: 3, 3 }}

    {{ "Intempt.com" | slice: '-4', 3 }}

Output

    t

    tom

    r.i

splitDivides an input string into an array using a separator you define. This filter is often used with a for loop.
Input{% assign rolling_stones = "Mick, Keith, Ronnie, Charlie" | split: ", " %}

{% for member in rolling_stones %}

  {{ member }}

{% endfor %}

removeRemoves a value from a string.
Input{{ "And that's all, folks!" | remove: ", folks" }}

Output

    And that's all!

stripStrips all whitespace, including tabs, spaces, and newlines, from the left and right side of a string.
Inputtext{{ " Intempt.com " | strip }}text

Output

    Intempt.com

strip_htmlRemoves HTML characters from a string.
Input{{ "Eh, what's up, Doc?" | strip_html }}

Output

    Eh, what's up, Doc?

strip_newlinesRemoves line breaks (\n) from a string.
Example{{ product.description | strip_newlines }}

titlecaseConverts a string to title case.
Syntax{{ 'string' | titlecase }}

Input

    {{ "rocket roller skates" | titlecase }}

Output

    Rocket Roller Skates

truncateShortens a string to the specified number of characters, adding an ellipsis if the string is longer than the value provided.
Input{{ "I knew I shoulda taken that left turn at Albuquerque." | truncate: 20 }}

Output

    I knew I shoulda ...

truncatewordsShortens a string to a specified number of words, rather than characters, and adds an ellipsis if the string contains more words than the value provided.
Input{{ "I knew I shoulda taken that left turn at Albuquerque." | truncatewords: 8 }}

Output

    I knew I shoulda taken that left turn...

upcaseConverts a string to upper case.
Syntax{{ 'string' | upcase }}

Input

    {{ 'acme' | upcase }}

Output

    ACME

url_decodeDecodes a string that has been encoded as a URL or has been modified by url_encode.
Input{{ "%27Intempt.com+is+great%27" | url_decode }}

Output

    Intempt.com is great

url_encodeEscapes/encodes URL-unsafe characters in a string.
Input{{ "[email protected]" | url_encode }}

Output

    cool.person%40example.com

Miscellaneous

These are tags that you can use to escape liquid rendering or escape rendering all together.

commentThis tag doesn’t show its contents, providing a way for you to leave notes inside templates for other members of your organization.
Syntax{% comment %} Don't display me! {% endcomment %}

generate_uuidGenerate a UUID.
Example{% generate_uuid %}

rawTemporarily disables Liquid processing. You might use this to escape tag processing if you use a conflicting syntax or you want to show raw liquid syntax in your message."
Example{% raw %}

  {{This}} is displayed exactly as typed.

{% endraw %}