Syntax Reference - leizongmin/tinyliquid GitHub Wiki
Example:
Hello, {{ name }}
Hello, {{ name | escape }} // variable value to escape
Example:
Uppercase: {{ name | upcase }}
The time now is: {{ "now" | date: "%H:%M:%S" }}
Nesting: {{ name | upcase | split: '-' }}
Get specific item index: {{ social_links | get:1 }}
Example:
{% if name == "old mine" %} Hello {{ name }} {% endif %}
{% unless name contains "Ray" %} not mine! {% endunless %}
{% if you.age < 18 %}
You're too young
{% else %}
Welcome to ...
{% endif %}
Note: The conditional operator can support equal to (==), not equal to (!= or <>), greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), contains the string (contains).
Example:
{% for item in array %}
{{ item }}
{% endfor %}
{% for item in (1..10) %}
{{ item }}
{% endfor %}
{% for item in array offset:2 limit:3 %}
{{ item }}
{% endfor %}
{% tablerow item in array cols:4 %}
{{ item }}
{% endtablerow %}
You can use variables for range (1..10)
, such as (1..num)
and (start..end)
, for more detail see issue #32
Example:
{% assign name = "value" %}
{% assign name = value | upcase %}
Example:
{% capture name %}
{% for item in array %}
{% item %}
{% endfor %}
{% endcapture %}
The output is saved to the variable *name* and you can output the results using: `{{ name }}`
Example:
{% cycle 'one', 'two', 'three' %},
{% cycle 'one', 'two', 'three' %},
{% cycle 'one', 'two', 'three' %},
{% cycle 'one', 'two', 'three' %}
Output: one,two,three,one
Example:
{% include "header" %}
{% include "header" with data %}
Variables support: see issue #11
Example:
{% raw %}{{ 5 | plus: 6 }}{% endraw %}
Output:
{{ 5 | plus: 6 }}
Example:
Hello world. {% comment %} Now this is a single-line comment {% endcomment %} <br />
Hello world,
I think I'm gonna be happy today. {% comment %} Now this is a
multi-line comment that should be ignored too,
just like the single-line comment {% endcomment %}
Output:
Hello world.
Hello world, I think I'm gonna be happy today.
Syntax reference can be found here: http://wiki.shopify.com/Liquid