Variable
Variable
Variable tags create new Liquid variables.
assign
Creates a new variable.
Input
{% assign my_variable = false %} {% if my_variable != true %} This statement is valid. {% endif %}
Output
This statement is valid.
Wrap a variable in quotations " to save it as a string.
Input
{% assign foo = "bar" %} {{ foo }}
Output
bar
capture
Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through {%capture%} are strings.
Input
{% capture my_variable %}I