- 04 Apr 2025
- 2 minute read
- Print
- DarkLight
- PDF
Liquid Markup Filters
- Updated 04 Apr 2025
- 2 minute read
- Print
- DarkLight
- PDF
In Liquid markup, filters let you transform data before it’s displayed.
This can be useful for modifying the returned value of merge fields or exports, without making adjustments to the underlying query.
Liquid provides a number of standard filter keywords, which we describe in this article.
How Liquid markup filters work
Add filters to text or a Slate query export you want to modify:
In a Liquid markup object
{{ }}
, place some text, or a query export’s name:{{"Hello world"}}
Add a pipe delimiter after that content:
{{"Hello World | }}
Add the filter keyword after the pipe delimiter:
{{"Hello World | upcase }}
The filter takes that text or export and transforms it accordingly: HELLO WORLD
Examples
Following the previous example, say you have an export, such as {{academic-intererests}}
, that you want to be all lowercase.
You can use downcase
:
{{academic-interests | downcase}}
Which renders the value of academic-interests
(say, Biology) as:
biology
Chaining filters
You can chain filters together to perform several actions in a row on the same export.
Filters work from left to right: each subsequent filter processes the output rendered by the previous one.
In this example, we take the value of the academic-interest
export and render it in all lowercase with downcase
. Then, the lowercase academic interest is shortened by truncate
to the specified 10
characters:
{{academic-interests | downcase | truncate: 10}}
So, a program like Environmental Sciences
would display as environmen
.
Standard Liquid filters
The following are standard filters that can operate on Slate exports and plain text:
Filter | Function | Example |
---|---|---|
| Formats a date |
|
| Divides two numbers |
|
| Sets all letters to lowercase |
|
| Returns first element of an array |
|
| Returns last element of an array |
|
| Returns only specified elements in an array |
|
| Subtracts two numbers |
|
| Returns the remainder after division |
|
| Adds two numbers |
|
| Replaces first occurrence of first parameter with the second parameter |
|
| Returns number of elements in an array, or number of characters in a string |
|
| Extracts a substring from a string, starting from first parameter’s position (starting from |
|
| Lets you ass in a value and output a content block |
|
| Splits string into an array on a specified delimiter |
|
| Removes HTML tags from a string |
|
| Multiples two numbers |
|
| Specify a maximum string length |
|
| Removes duplicate values in an array |
|
| Sets all letters to uppercase |
|
📖 Further reading: See the Shopify documentation on Liquid markup filters.