The following are logical and comparison operators used within conditional tags.

OperatorDescription
==equals
!=does not equal
>greater than
<less than
>=greater than or equal to
<=less than or equal to
ormatches condition A or B
andmatches condition A and B
containsmatches substrings or strings in arrays

Numerical operators such as + and - are not supported. Instead, you would use the mathematical filters such as {{ a | plus: b }} and {{ a | plus: b }}. See the Math filter section for more details.

Tags are surrounded by {% ... %} delimiters and are always closed with a matching end tag.

Example
{% if account %}
  Hello, {{ account.name }}
{% endif %}

Filters are used to modify output or assignment of a variable, separate by a pipe | character. They can take one or more positional or named arguments.

Example
{{ product.price | money }}

Liquid templates are formatted for readability, however it can affect the HTML output in undesirable ways. Use a hyphen - character on either or both sides of any tag to cause Liquid to strip whitespace on the left and right sides of the tag.

Example
{%- if category.products.size > 0 -%}
  ...
{%- endif -%}

Also note, each tag outputs a trailing newline \n character, however adding a hyphen to the end of the tag will strip the newline from output.

Example
{% assign author = "emmett" -%}
{{ author }}

The following are supported conditional tags for output control.

TagDescription
ifrender output if conditions match
elseifalternate `if` expression
elserender output if no previous conditions match
unlessrender output if conditions do not match
caseswitch output between one or more `when` tags

See the Conditional tags section for more details.

The following are tags used to iterate through array and collection values.

` and `
TagDescription
forrenders output for every item of an array
elsealternate output when `for` has zero length
breakstops a `for` loop from iterating
continuecauses a `for` loop to skip to the next iteration
cyclerenders an output from a list of strings for each `for` loop iteration
tablerowrender HTML `
tags for each item in an array
paginateiterates through a collection across multiple pages

See the Iteration tags section for more details.

The following are tags to control how Liquid is processed and rendered.

TagDescription
commentprevents an expression from being rendered
echooutputs an expression, usable inside `{% liquid %}` tags
liquida block of Liquid code without individual delimiters
rawouputs any Liquid code without rendering it

See the Syntax tags section for more details.

TagDescription
assigncreates or overwrites a variable with the assigned value
capturecapture a variable value as the expression output
decrementdecreases the value of a numeric variable by 1
incrementincreases the value of a numeric variable by 1

See the Variable tags section for more details.