Built-in filters

We will list the most useful filters here. You can find the complete list of filters in the official Liquid documentationarrow-up-right.

append

Read the complete append documentation.arrow-up-right

Adds the specified string to the end of another string.

Input
{{"/my/fancy/url" | append: ".html"}}
Output
/my/fancy/url.html

date

Read the complete date documentation.arrow-up-right

Converts a timestamp into another date format. The format for this syntax is the same as strftimearrow-up-right. The input uses the same format as Ruby’s Time.parsearrow-up-right.

Input
{{article.published_at | date: "%a, %b %d, %y"}}
Output
Fri, Jul 17, 22
Input
{{article.published_at | date: "%Y"}}
Output
2022

date works on strings if they contain well-formatted dates

Input
{{"March 14, 2022" | date: "%b %d, %y"}}
Output
Mar 14, 22

To get the current time, pass the special word "now" (or "today") to date.

circle-info

Need a timezone?

Take a look at the in_time_zone filter provided by PDFMonkey.

default

Read the complete default documentation.arrow-up-right

Sets a default value for any variable with no assigned value. default will show its value if the input is nil, false, or empty.

In this example, product_price is not defined, so the default value is used.

In this example, product_price is defined, so the default value is not used.

In this example, product_price is empty, so the default value is used.

divided_by

Read the complete divided_by documentation.arrow-up-right

Divides a number by another number.

circle-info

Rounded result

The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.

minus

Read the complete minus documentation.arrow-up-right

Subtracts a number from another number.

newline_to_br

Read the complete newline_to_br documentation.arrow-up-right

Inserts an HTML line break (<br />) in front of each newline () in a string.

plus

Read the complete plus documentation.arrow-up-right

Adds a number to another number.

times

Read the complete times documentation.arrow-up-right

Multiplies a number by another number.

where

Read the complete where documentation.arrow-up-right

Creates an array including only the objects with a given property value, or any truthyarrow-up-right value by default.

In this example, assume you have a list of products and you want to show your kitchen products separately. Using where, you can create an array containing only the products that have a "type" of "kitchen".

Last updated

Was this helpful?