Use this document to guide you in using standard Liquid filters.
Returns the absolute value of a number.
Input
Output
Input
Output
Input
Output
Concatenates two strings and returns the concatenated value.
Input
Output
Input
Output
Input
Output
Limits a number to a minimum value.
Input
Output
Input
Output
Limits a number to a maximum value.
Input
Output
Input
Output
Makes the first character of a string capitalized.
Input
Output
Input
Output
Rounds the input up to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.
Input
Output
Input
Output
Input
Output
Here the input value is a string:
Input
Output
Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays.
Input
Output
You can string together
Input
Output
Converts a timestamp into another date format. The format for this syntax is the same as
Input
Output
Input
Output
Input
Output
To get the current time, pass the special word
Input
Output
Note that the value will be the current time of when the page was last generated from the template, not when the page is presented to a user if caching or static site generation is involved.
Allows you to specify a fallback in case a value doesn’t exist.
Input
Output
In this example,
Input
Output
In this example,
Input
Output
To allow variables to return
Input
Output
Divides a number by the specified number. The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.
Input
Output
Input
Output
For example, here the divisor is an integer:
Input
Output
Here it is a float:
Input
Output
You might want to use a variable as a divisor, in which case you can’t simply add .0 to convert it to a float. In these cases, you can assign a version of your variable converted to a float using the
In this example, you’re dividing by a variable that contains an integer, so you get an integer:
Input
Output
Here, you multiply the variable by
Input
Output
Makes each character in a string lowercase. It has no effect on strings that are already all lowercase.
Input
Output
Input
Output
Escapes a string by replacing characters with escape sequences (so that the string can be used in a URL, for example). It doesn’t change strings that don’t have anything to escape.
Input
Output
Input
Output
Input
Output
Input
Output
Rounds a number down to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.
Input
Output
Input
Output
Input
Output
Here the input value is a string:
Input
Output
Combines the items in an array into a single string using the argument as a separator.
Input
Output
Returns the last item of an array.
Input
Output
Input
Output
Removes all whitespaces (tabs, spaces, and newlines) from the beginning of a string. The filter does not affect spaces between words.
Input
Output
We have overwritten the map filter so it will not work in the standard way. Visit the reference for the Insites map filter to learn more.
Subtracts a number from another number.
Input
Output
Input
Output
Input
Output
Returns the remainder of a division operation.
Input
Output
Input
Output
Input
Output
Replaces every newline
Input
Output
Adds a number to another number.
Input
Output
Input
Output
Input
Output
Adds the specified string to the beginning of another string.
Input
Output
You can also prepend variables:
Input
Output
Removes every occurrence of the specified substring from a string.
Input
Output
Removes only the first occurrence of the specified substring from a string.
Input
Output
Replaces every occurrence of an argument in a string with the second argument.
Input
Output
Replaces only the first occurrence of the first argument in a string with the second argument.
Input
Output
Reverses the order of the items in an array.
Input
Output
Input
Output
Rounds an input number to the nearest
Input
Output
Input
Output
Input
Output
Removes all whitespace (tabs, spaces, and newlines) from the right side of a string.
Input
Output
Returns the number of characters in a string, the number of items in an array, or the number of bytes needed to store the integer in memory.
Input
Output
Input
Output
Using dot notation:
Returns a substring of 1 character beginning at the index specified by the argument passed in. An optional second argument specifies the length of the substring to be returned.
String indices are numbered starting from 0.
Input
Output
Input
Output
Input
Output
If the first parameter is a negative number, the indices are counted from the end of the string:
Input
Output
Sorts items in an array by a property of an item in the array. The order of the sorted array is case-sensitive, meaning all capitalized strings will come before any lowercase strings.
Input
Output
Sorts items in an array by a property of an item in the array. The order of the sorted array is case-insensitive.
Input
Output
Divides an input string into an array using the argument as a separator.
Input
Output
Removes all whitespace (tabs, spaces, and newlines) from both the left and right sides of a string. It does not affect spaces between words.
Input
Output
Removes any HTML tags from a string.
Input
Output
Removes any newline characters (line breaks) from a string.
Input
Output
Multiplies a number by another number.
Input
Output
Input
Output
Input
Output
Input
Output
The length of the second parameter counts against the number of characters specified by the first parameter.
For example, if you want to truncate a string to exactly 10 characters, and use a 3-character ellipsis, use 13 for the first parameter of
Input
Output
You can truncate to the exact number of characters specified by the first parameter and show no trailing characters by passing a blank string as the second parameter:
Input
Output
Shortens a string down to the number of words passed as the argument. If the specified number of words is less than the number of words in the string, an ellipsis (…) is appended to the string.
Input
Output
Input
Output
You can avoid showing trailing characters by passing a blank string as the second parameter:
Input
Output
Removes any duplicate elements in an array.
Input
Output
Makes each character in a string uppercase. It has no effect on strings that are already all uppercase.
Input
Output
Input
Output
Decodes a string that has been encoded as a URL or by
Input
Output
Converts any URL-unsafe characters in a string into per cent-encoded characters.
Input
Output
Input
Output
Creates an array comprising objects with a specified property value or any
For example, suppose you have a list of products and want to display kitchen products separately. By employing
Input
Output
Consider instead, a scenario where you have a list of products, and your objective is to display only those available for purchase. In this case, you can employ
Input
Output
The
Input
Output
Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.