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 value in quotations " to save it as a string.

Input

{% assign foo = "bar" %}
{{ foo }}

Output

bar
PDF HTML Epub Powered by Read The Docs