API reference - platformOS Liquid Filters

Last edit: 

Contributors: 

Liquid filters are simple methods that modify the output of numbers, strings, variables and objects. They are placed within an output tag {{ }} and are denoted by a pipe character |.

Example:


{{ "honda crx" | upcase }} => HONDA CRX

Some filters accept arguments, for example replace filter accepts two:


{{ 'Hello liquid' | replace: 'liquid', 'world!' }} => Hello world!

Having verbose version of code that will:

  1. Create string with words
  2. Prepend "Zero," in front of the string
  3. Append ",Five" string at the end
  4. Split it by comma to create an array of strings
  5. Print it to the source

{% assign numbers = 'One,Two,Three,Four' %}
{% assign numbersWithZero = 'One,Two,Three,Four' | prepend: 'Zero,' %}
{% assign all_numbers = numbersWithZero | append: ',Five' %}
{% assign all_numbers_array = all_numbers | split: ',' %}
{{ all_numbers_array }} => ZeroOneTwoThreeFourFive

You can achieve the same result in much shorter form by chaining the filters one after another:


{{ 'One,Two,Three,Four' | prepend: 'Zero,' | append: ',Five' | split: ',' }} => ZeroOneTwoThreeFourFive

Liquid filters in platformOS

In platformOS you can use all standard Liquid filters:

Besides standard Liquid filters, you can also use custom Liquid filters we added.