Liquid Markup Overview
Published on July 21, 2022, updated on November 15, 2022
Liquid (or Liquid Markup) is a template language used by Insites to build dynamic pages and to provide dynamic configuration (E.g. based on the currently logged-in user).
Use Liquid to provide an authorisation policy for forms and pages or to specify notifications (email, SMS, API). We have added a lot of filters and tags to make your life easier.
This article is divided into the following sections:
- Output
- Tags
- Filters
- Raw
- Comment
Note
Liquid has a new syntax — visit the documentation of the liquid tag for an example. We are updating all of our Liquid code examples to reflect this change.
Output
Output markup (which may resolve to text) is surrounded by:
Example:
Tags
Tag markup (which cannot resolve to text) is surrounded by:
Example:
Filters
Liquid filters are simple methods that modify the output of numbers, strings, variables, and objects.
Simple Use Case:
Arguments
Some filters accept arguments. For example, the 'replace' filter accepts two:
Chaining
Having a verbose version of code that will:
- Create a string with words.
- Prepend "Zero" in front of the string.
- Append the "Five" string at the end.
- Split it by comma to create an array of strings.
- Print it to the source.
You can achieve the same result in a much shorter form by chaining the filters one after another:
Raw
If you want to use liquid text on your page without executing it, use .
Comment
Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing comment blocks will not be output, and any Liquid code within will not be executed.
Input
Output
You can also use inside the tag: