Liquid is an open-source template language created by Shopify. It’s designed to enable developers to build dynamic web pages by integrating data from Shopify or other data sources into the HTML. Liquid acts as the intermediary between the source data and the rendered output seen by users.
Liquid has three main components:
- Objects: These represent variables that output data onto the page. For example,
{{ product.title }}
displays the title of a product. - Tags: These control the logic and flow of the template, such as conditionals and loops. Tags are denoted by
{% %}
, like{% if %}
and{% for %}
. - Filters: These modify the output of objects, allowing transformations such as formatting text or numbers. For example,
{{ product.price | money }}
formats a price as currency.
Liquid is used extensively in Shopify themes but can also be found in other platforms (example: Jekyll, Magento etc) that need flexible template engines.