mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
This commit is contained in:
41
docs/content/en/methods/site/Sections.md
Normal file
41
docs/content/en/methods/site/Sections.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: Sections
|
||||
description: Returns a collection of first level section pages.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/site/AllPages
|
||||
- methods/site/Pages
|
||||
- methods/site/RegularPages
|
||||
returnType: page.Pages
|
||||
signatures: [SITE.Sections]
|
||||
---
|
||||
|
||||
Given this content structure:
|
||||
|
||||
```text
|
||||
content/
|
||||
├── books/
|
||||
│ ├── book-1.md
|
||||
│ └── book-2.md
|
||||
├── films/
|
||||
│ ├── film-1.md
|
||||
│ └── film-2.md
|
||||
└── _index.md
|
||||
```
|
||||
|
||||
This template:
|
||||
|
||||
```go-html-template
|
||||
{{ range .Site.Sections }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Is rendered to:
|
||||
|
||||
```html
|
||||
<h2><a href="/books/">Books</a></h2>
|
||||
<h2><a href="/films/">Films</a></h2>
|
||||
```
|
Reference in New Issue
Block a user