Introduction

Liquid code can be categorized into objects, tags, and filters.

Objects

Objects tell Liquid where to show content on a page. Objects and variable names are denoted by double curly braces: {{ and }}.

Input

{{ page.title }}

Output

Introduction

In this case, Liquid is rendering the content of an object called page.title, and that object contains the text Introduction.

Tags

Tags create the logic and control flow for templates. They are denoted by curly braces and percent signs: {% and %}.

The markup used in tags does not produce any visible text. This means that you can assign variables and create conditions and loops without showing any of the Liquid logic on the page.

Input

{% if user %}
  Hello {{ user.name }}!
{% endif %}

Output

Hello Adam!

Tags can be categorized into three types:

You can read more about each type of tag in their respective sections.

Filters

Filters change the output of a Liquid object. They are used within an output and are separated by a |.

Input

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

Output

/my/fancy/url.html

Multiple filters can be used on one output. They are applied from left to right.

Input

{{ "adam!" | capitalize | prepend: "Hello " }}

Output

Hello Adam!

© 2005, 2006 Tobias Luetke
Licensed under the MIT License.
https://shopify.github.io/liquid/basics/introduction/