# Liquid Reference Guide
## Overview
Liquid is a template language created by Shopify and available as an open source project on GitHub. It's used by many software projects and companies. This reference documents the Liquid tags, filters, and objects for building Shopify Themes.
## What is a Template Language?
A template language enables creating a single template with static content while dynamically inserting information based on context. For example, a product template can render standard attributes like image, title, and price with appropriate content for each product being viewed.
## Variations of Liquid
The Liquid variation documented here extends the open-source version for Shopify themes, including theme-specific tags, filters, and objects. Shopify uses slightly different Liquid versions for:
- **Notification templates**: [Email variables](https://help.shopify.com/en/manual/orders/notifications/email-variables)
- **Shopify Flow**: [Flow variables](https://help.shopify.com/en/manual/shopify-flow/reference/variables#liquid-variables)
- **Order printer templates**: [Printing orders](https://help.shopify.com/en/manual/fulfillment/managing-orders/printing-orders/shopify-order-printer/liquid-variables-and-filters-reference)
- **Packing slip templates**: [Packing slips](https://help.shopify.com/en/manual/orders/packing-slips-variable-list)
## Liquid Basics
Liquid dynamically outputs objects and their properties. Output can be modified using tags for logic or filters for alteration. Objects and properties use six basic data types, with logical and comparison operators available for tags.
**Key Resources:**
- [Basics](/docs/api/liquid/basics)
## Defining Logic with Tags
Tags create logic instructing templates what to do. They're wrapped in curly brace percentage delimiters `{% %}`. The text within is an instruction, not rendered content.
### Example: Conditional Logic
```liquid
{% if product.available %}
Price: $99.99
{% else %}
Sorry, this product is sold out.
{% endif %}
```
To nest multiple tags, use the [`liquid`](/docs/api/liquid/tags/liquid) tag.
### Tags with Parameters
Some tags accept required or optional parameters. For example, the `for` tag accepts an optional `limit` parameter:
```liquid
{% assign numbers = '1,2,3,4,5' | split: ',' %}
{% for item in numbers limit:2 -%}
{{ item }}
{% endfor %}
```
**Output:** `1 2`
## Modifying Output with Filters
Filters modify variable and object output using the pipe character `|` followed by the filter name.
### Example: Single Filter
```liquid
{% # product.title -> Health potion %}
{{ product.title | upcase }}
```
**Output:** `HEALTH POTION`
### Filters with Parameters
Many filters accept required or optional parameters adjusting output:
```liquid
{% # product.title -> Health potion %}
{{ product.title | remove: 'Health' }}
```
**Output:** `potion`
### Using Multiple Filters
Multiple filters applied left to right:
```liquid
{% # product.title -> Health potion %}
{{ product.title | upcase | remove: 'HEALTH' }}
```
**Output:** `POTION`
## Referencing Objects
Liquid objects represent variables for theme building. Types include store resources (collections, products), standard content (content_for_header), and functional elements (paginate, search).
### Usage
Output objects with double curly brace delimiters `{{ }}`. Access properties using dot notation:
```liquid
{{ product.title }}
```
**Output:** `Health potion`
### Object Access
Objects are accessible:
- **Globally**: In any Liquid file (excluding [checkout.liquid](/themes/architecture/layouts/checkout-liquid) and [Liquid asset files](/themes/architecture#assets))
- **In templates**: Specific templates with sections/blocks (e.g., [`product`](/docs/api/liquid/objects/product) in product templates)
- **Through parent objects**: Returned as properties of other objects (e.g., [`article`](/docs/api/liquid/objects/article) through [`articles`](/docs/api/liquid/objects/articles))
### Creating Variables
Create custom variables with tags like [`assign`](/docs/api/liquid/tags/assign) or [`capture`](/docs/api/liquid/tags/capture). Liquid treats variables syntactically identical to objects.
## Practical Example
```liquid
<title>
{{ page_title }}
</title>
{% if page_description -%}
<meta name="description" content="{{ page_description | truncate: 150 }}">
{%- endif %}
```
**Output Example:**
```html
<title>
Health potion
</title>
<meta name="description" content="Are you low on health? Well we've got the potion just for you! Just need a top up? Almost dead? In between? No need to worry...">
```