Liquid Field

Liquid is an open source template language used by many different software projects and companies.

What is a template language?

A template language allows you to create a static content or text, and dynamically insert information depending on where the template is rendered. For example, you can create a use any field value on a piece of content manipulating, altering, changing, and combining the field values to create any dynamic and custom value. That template can then dynamically render those field values to deliver to any Endpoint in Impulse

Liquid basics

Liquid is used to dynamically output fields. You can further modify that output by creating logic with tags, or directly altering it with a filter. Liquid also includes basic logical and comparison operators for use with tags.

<div>
  {{ content.fields.title.value  }}
</div>
{% if content.fields.other.value.size > 0 %}if condition matched{% endif %}
  <p>
    {{ content.fields.description.value | truncate: 150 }}">
  </p>
{% endif %}

Modifying output with filters

Liquid filters are used to modify the output of field values and objects. To apply filters to an output, add the filter and any filter parameters within the output's curly brace delimiters, preceded by a pipe character.

Multiple filters can be used on one output. They’re parsed from left to right.

{{ | }}Filters are placed within an output tag and denoted by a pipe character.

Consider the below example. In this case content.fields.title.value is set to "My Really Cool Title"

{{ content.fields.title.value | upcase | remove: 'My ' }}

The output would be

REALLY COOL TITLE

Last updated