Sections
Returns a collection of top-level section pages.
- Syntax
- SITE.Sections
- Returns
- page.Pages
The Sections method on a Site object returns a collection of top-level section pages, in the default sort order.
Given this content structure:
content/
├── books/
│ ├── book-1.md
│ └── book-2.md
├── films/
│ ├── film-1.md
│ └── film-2.md
└── _index.mdThis template:
{{ range site.Sections }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}Is rendered to:
<h2><a href="/books/">Books</a></h2>
<h2><a href="/films/">Films</a></h2>Last updated:
November 2, 2026
:
content: Prefer site function in code examples (3350b883b)
Improve this page