Qalab Basics
Core concepts for working with Qalab templates.
Handles
Handles are URL-friendly identifiers for store resources (products, collections, pages).
{{ product.handle }} {# health-potion #}
{{ collection.handle }} {# summer-sale #}
Handle rules:
- Always lowercase
- Spaces become hyphens
- Special characters removed
- Must be unique (duplicates get
-1,-2, etc.)
Accessing by Handle
{# Square bracket notation #}
{{ pages['about-us'].url }}
{# Dot notation #}
{{ settings.header_color }}
Operators
Comparison
| Operator | Meaning |
|---|---|
== | equals |
!= | not equals |
> | greater than |
< | less than |
>= | greater or equal |
<= | less or equal |
Logical
| Operator | Meaning |
|---|---|
and | both true |
or | either true |
contains | string/array contains value |
{% if product.price > 100 and product.available %}
Premium product in stock
{% endif %}
{% if product.tags contains 'sale' %}
On sale!
{% endif %}
Data Types
| Type | Example |
|---|---|
| string | "Hello" or 'Hello' |
| number | 42, 3.14 |
| boolean | true, false |
| null | undefined value |
| array | [1, 2, 3] |
Truthy and Falsy
Only false and null are falsy. Everything else is truthy:
{# Empty string is truthy - use blank to check #}
{% if settings.title != blank %}
{{ settings.title }}
{% endif %}
{# Empty object is truthy - use empty to check #}
{% if product != empty %}
{{ product.title }}
{% endif %}
Whitespace Control
Add hyphens to remove whitespace:
{# With whitespace #}
{% if true %}
Hello
{% endif %}
{# Without whitespace #}
{%- if true -%}
Hello
{%- endif -%}