for
Repeat content for each item in an array.
Syntax
1{% for item in items %}...{% endfor %}Usage
- Use the name after
forto access the current item. Close the block withendfor. - An empty or missing array produces no output.
- Each item is separated by a line break. Leave an extra blank line before
endforto separate paragraphs or tables.
Loop values
loop.indexis the current item number, starting at 1.loop.index0starts at 0.loop.firstandloop.lastare true for the first and last items.loop.lengthis the total number of items.
Example
Open in Playground| Data | |
|---|---|
| Template | |
| Output | |