Pages
Grab and iterate over child pages.
Usage
This tag has the same functionality as the collection tag, with some differences.
The pages
tag will attempt to get the child pages of a specified parent page.
For example, given this page structure:
about/
|-- index.md
|-- 1.team/
| |-- 1.board/
| | |-- index.md
| |-- index.md
|-- 2.news/
| |-- index.md
{{ pages from="/about" }}
{{ order }}. {{ title }}
{{ /pages }}
1. Team
2. News
Notice only the immediate child pages are output. If we wanted to get the next level, we can specify the depth
parameter.
{{ pages from="/about" depth="2" }}
{{ order }}. {{ title }}
{{ /pages }}
1. Board
1. Team
2. News
Notice that (by default) the pages are being sorted by the order key, then alphabetically. They are also displayed in a single list, as siblings. If you’d like to output the hierarchy, you should use the Nav Tag.
Parameters
url
string |
The URL of the parent page from where to find its subpages. If this parameter isn’t specified, Statamic will look at the current URL. |
---|---|
id
string |
Just like |
from
string |
Just like |
from_id
string |
Just like |
folder
string |
Alias of |
depth
integer 1 |
How deep to traverse the hierarchy to find child pages. |
filter
wizardry |
Filter pages using a special conditions syntax, the same as the Collections tag. View the available conditions. |
supplement_taxonomies
boolean true |
By default, Statamic will convert taxonomy term values into actual term objects that you may loop through. This has some performance overhead, so you may disable this for a speed boost if taxonomies aren't necessary. |