Collections are lists of items that can be iterated using foreach loops. They always exist and are automatically populated with a default set of items when a page is rendered. The actual content of a collection depends on the current context and can be modified, sorted and filtered using the matching functions.
<@ foreach in pagelist @>
<a href="@{ url }">@{ title }</a>
<@ end @>
Available Collections
There are four different collections available:
| Collection | Description |
|---|---|
| pagelist | A configurable list of pages. By default, all pages that are not hidden. |
| filelist | A configurable list of files. By default, all images of the current page. |
| tags | The tags of the current page. |
| filters | All unique tags of the pages in the current pagelist. |
Configuring Collections
The pagelist and the filelist can be configured using the newPagelist, pagelist and filelist functions. Since the filters collection is derived from the pages in the pagelist, it changes automatically whenever the pagelist is updated. The tags collection always reflects the tags of the current context.
<@ newPagelist {
type: 'children',
sort: 'date desc'
} @>
<@ foreach in pagelist @>
<h2>@{ title }</h2>
<@ foreach in tags @>
<span>@{ :tag }</span>
<@ end @>
<@ end @>