Statico Source
Contents

Loops

Repeat markup over collections and markdown content with the ForEach tag.

Building pages, page 9

<ForEach collection="menu" as="item">
    <a href="{item.link}">{item.title}</a>
</ForEach>
AttributeMeaning
collection="menu"collections/menu.json (or .yaml/.toml/.csv)
collection="post.tags"a list inside the current loop item (nested loops)
collection="taxonomy/tags"all tags: {name, slug, count, url}
content="posts"markdown files in content/posts
as="post"loop variable name (default: the collection name)
orderBy="date, desc"sort by a field
where="post.featured && !post.draft"filter (same syntax as conditions)
count="3", offset="1"limit / skip
paginate="10"10 per page; the build writes /page/2/, …

Inside a loop: {loop} (1-based index), {$loop.index}, {$loop.index0}, {$loop.first}, {$loop.last}, {$loop.count}, {$loop.total}.

Content items have their front matter plus link (/posts/hello), url (/posts/hello/), slug, content (markdown) and html (rendered).