Liqiud basics
Modules
API
Mailer
Variables
Overview
Short info on variables
Read more: https://shopify.github.io/liquid/tags/variable/
assign
Repeatedly executes a block of code. For a full list of attributes avalible within a for loop, see the table above.
{% assign voldemort == 'He who shall not be named' %}
{{ voldemort }}
He who shall not be named
capture
Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through capture are strings.
{% capture my_variable %}I am being captured.{% endcapture %}
{{ my_variable }}
I am being captured.
Using capture, you can create complex strings using other variables created with assign:
{% assign favorite_food = "pizza" %}
{% assign age = 35 %}
{% capture about_me %}
I am {{ age }} and my favorite food is {{ favorite_food }}.
{% endcapture %}
{{ about_me }}
I am 35 and my favourite food is pizza.
increment
Creates a new number variable, and increases its value by one every time it is called. The initial value is 0.
{% increment my_counter %}
{% increment my_counter %}
{% increment my_counter %} 0
1
2
decrement
Creates a new number variable, and decreases its value by one every time it is called. The initial value is -1.
{% decrement variable %}
{% decrement variable %}
{% decrement variable %} -1
-2
-3Updated: 2020-11-03