Filters

A filter modifies a given value to a new value. Usually this will result in a value of the same type as the input value, but could also give a totally different type. Within a Liquid tag (e.g. within {{ … }} tags) you can use the | character to direct the output of the left side of that character to a filter.

Example:


{{ 'Hello World' | upcase }}
		

Output:


HELLO WORLD
		

Example:


{{ 'Hello World' | size }}
		

Output:


11
		

Some filter have one or more parameters, these will be added after the filter name followed by a ‘:’ character. If there are several arguments to that function, they will be comma separated.

Example:


{{ 'Blue' | replace: 'Blue', 'Red' }}
		

Output:


Red
		

Further it is possible to chain several filter.

Example:


{{ product.title | append: ' (Movie)' | downcase }}
		

Output:


big buck bunny (movie)
		

The product title (in this example ‘Big Buck Bunny’) is used as input for the append filter. Then the append filter adds the string ‘ (Movie)’ behind the input string (resulting in ‘Big Buck Bunny (Movie)’). Finally this result is passed into the last filter of name downcase, which will lower all characters in the string, resulting in ‘big buck bunny (movie)’.

The following filters are available:

Read more: