All guides

Guide

Shopify Liquid Cheat Sheet 2026

Liquid Basics — Syntax, Handles and Global Variables

The building blocks every Shopify theme developer uses daily: how Liquid is written, how handles work, and the global variables available on every page.

01

Two types of Liquid markup

Output tags {{ }} print a value; logic tags {% %} run code without printing. Add a hyphen ({{- -}}, {%- -%}) to strip surrounding whitespace.

{{ product.title }}
{% if product.available %}In stock{% endif %}
{%- assign clean = 'no extra whitespace' -%}
02

What is a handle?

A handle is the URL-friendly, lowercase, hyphenated identifier of a resource, generated from its title. "Summer Sale!" becomes summer-sale. Use handles, not IDs, to reference resources in themes.

{{ collections['summer-sale'].title }}
{{ 'Summer Sale!' | handleize }}  → summer-sale
03

Check if a variable is blank, empty or null

Compare against blank to catch nil, empty strings and empty arrays in one check. Use empty for arrays and strings only.

{% if product.description != blank %}
  {{ product.description }}
{% endif %}
04

page_title

Global variable holding the page's title, used to build the <title> tag in theme.liquid.

<title>{{ page_title }} | {{ shop.name }}</title>
05

page_description

Global variable holding the resource's SEO description, if one is set. Use it for the meta description tag.

{% if page_description %}
  <meta name="description" content="{{ page_description | escape }}">
{% endif %}
06

layout

Sets which layout file a template uses, or disables the layout entirely. Place it at the top of a Liquid template.

{% layout 'alternate' %}
{% layout none %}
07

current_tags

On collection and blog pages filtered by tags, returns the tags currently applied.

{% if current_tags %}
  Filtered by: {{ current_tags | join: ', ' }}
{% endif %}
08

Search only products

Add a hidden type field to the search form so results return products only.

<form action="{{ routes.search_url }}">
  <input type="hidden" name="type" value="product">
  <input type="search" name="q">
</form>

Shopify experts

Let's talk ecommerce, Shopify & Shopify Plus solutions.

TAB ON TECH helps ecommerce brands build, improve, and grow Shopify stores. We support new builds, migrations, ongoing development, SEO, and conversion optimisation.

Our team can help plan the right approach based on your store, goals, and current challenges.

Get in touch