Loops¶
Render lists and repeat sections using for loops.
Syntax
# Items
{% for item in items %}
- {{item}}
{% endfor %}
Example context
{ "items": ["apple", "banana", "cherry"] }
Rendered result
Using the example context the rendered output will be:
# Items
- apple
- banana
- cherry
Notes
- The loop variable (
itemabove) is whatever identifier you declare in theforstatement. itemsmust be an array in the provided context.- Nested loops are supported by composing loop blocks.
Tip: Prepare and validate list data in the context rather than trying to transform large datasets inside the template.