cycle
cycle is a Liquid tag to cycle through a set of values. It is a Liquid built-in tag.
Syntax
{% cycle ["name":] value1, value2, [value3...] %}
cycle expects at least one variable to be given. It will return the first value when it's called the first time, the second value the second time, and so on. When the end of the list is reached, it starts over again.
If you want to cycle through different lists at the same time (or the same list but at another rate), use the parameter name to give the list a name.
Examples
{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
=> one
two
three
one
{% cycle 'group 1': 'odd', 'even' %}
{% cycle 'group 1': 'odd', 'even' %}
{% cycle 'group 1': 'odd', 'even' %}
{% cycle 'group 2': 'odd', 'even' %}
{% cycle 'group 2': 'odd', 'even' %}
{% cycle 'group 1': 'odd', 'even' %}
=> odd
even
odd
odd
even
even
page_revision: 3, last_edited: 1180550635|%e %b %Y, %H:%M %Z (%O ago)





