Last updated: 2014-09-02
Source: https://support.freshdesk.com/support/solutions/articles/65038-looping-and-iteration
You can iterate through HTML or liquid code by using the For loop. Loops are especially useful for things like running through and displaying all the solutions under a specific folder.
Syntax:
{% for item in array %}<!-- Do something with each item -->{% endfor %}
You can also limit the number of iterations by using the limit parameter.
> {% for folder in category.folders limit: 6 %}
> > <!\-\- Just show the first 6 folders -->
> {% endfor %}
There are times when you want to start looping from the second, fifth or the n’th item in your list. You can do this using the offset parameter.
{% for forum in portal.forums offset: 2 %}
> <!\-\- Start the loop from the 3rd forum -->
{% endfor %}