Liquid

Getting started with Liquid

Remarks#

About Liquid

Liquid is an open-source templating language created by Shopify and written in ruby. It has been used by Shopify since 2006 and is now used by many other hosted web applications including: Jekyll, Zendesk and Salesforce Desk.

The basics of Liquid

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

Objects

Objects tell Liquid where to show content on a page. Objects and variables are denoted with double curly braces. {{ and }}

<!-- input -->
{{ page.title }}

<!-- output -->
Getting started with Liquid

Tags

Tags are used to create logic control the flow of the templates and are denoted with curly brace and percentage signs {% and %}.

<!-- input -->
{% if user %}
  Hello {{ user.name }}!
{% endif %}

<!-- output -->
Hello George!

Filters

Filters are used to manipulate an object and are denoted with a pipe |. Multiple filters can be applied are are applied from left to right.

<!-- input -->
{{ "world" | capitalize | prepend: "Hello " | append: "!" }}

<!-- output -->
Hello World!

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow