Output
Tag
assign
capture
case
cycle
for
if
unless
include
comment
ifchanged
{% capture heading %} Tustena is the best! {% endcapture %} ... <h1>{{ heading }}</h1>
{% assign foo = 'monkey' %} {{ foo }}
{% for item in items %} <div class="{% cycle 'red', 'green', 'blue' %}"> {{ item }} </div> {% end %}
{% case template %} {% when 'index' %} Welcome {% when 'product' %} {{ product.vendor | link_to_vendor }} / {{ product.title }} {% else %} {{ page_title }} {% endcase %}
{% for item in collection %} {{ forloop.index }}: {{ item.name }} {% endfor %}
{% for item in collection %} <div {% if forloop.first %}class="first"{% endif %}> Item {{ forloop.index }}: {{ item.name }} </div> {% endfor %}
{% for item in collection limit:5 offset:10 %} {{ item.name }} {% end %}
{% for item in collection reversed %}
forloop.name
forloop.length
forloop.index
forloop.index0
forloop.rindex
forloop.rindex0
forloop.first
forloop.last
# array = [1,2,3,4,5,6] {% for item in array limit:2 offset:2 %} {{ item }} {% endfor %} # results in 3,4
{% unless x < 0 %} x is greater than zero {% end %}
{% if user.admin %} Admin user! {% else %} Not admin user {% endif %} There are {% if count < 5 %} less {% else %} more {% endif %} items than you need.
{% ifchanged %} <div class="date">{{ article.published_at | date: '%B %d' }}</div> {% endifchanged %} <div class="time">{{ article.published_at | date: '%I:%M %p' }}</div>
{% tablerow item in items cols: 3 limit: 12 %} {{ item.variable }} {% endtablerow %}
tablerowloop.length
tablerowloop.index
tablerowloop.index0
tablerowloop.rindex
tablerowloop.rindex0
tablerowloop.first
tablerowloop.last
tablerowloop.col
tablerowloop.col0
tablerowloop.col_first
tablerowloop.col_last
{% tablerow item in items cols: 3 %} {% if col_first %} First column: {{ item.variable }} {% else %} Different column: {{ item.variable }} {% endif %} {% endtablerow %}
date
capitalize
downcase
upcase
first
last
join
sort
map
size
escape
escape_once
strip_html
strip_newlines
newline_to_br
replace
replace_first
remove
remove_first
truncate
truncatewords
prepend
append
minus
plus
times
divided_by
sum
multiply
divide
subtract
format_as_money
empty_cell
split
format_date
is_date
chars
capitalize_all
format_as_percentage
format_discount_formula
format_time
format_decimal
default
get_lead_cross_string
discount
str_len
now / tustena_now
tustena_url