Sections
返回頂級節頁面的集合。
Syntax
SITE.Sections
Returns
page.Pages
Site 對象上的 Sections 方法返回頂級 節頁面 的集合,按 默認排序順序。
給定此內容結構:
content/
├── books/
│ ├── book-1.md
│ └── book-2.md
├── films/
│ ├── film-1.md
│ └── film-2.md
└── _index.md此模板:
{{ range .Site.Sections }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}渲染為:
<h2><a href="/books/">Books</a></h2>
<h2><a href="/films/">Films</a></h2>