HUGO
Menu
GitHub 87548 stars Mastodon

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>

Last updated: January 1, 0001
Improve this page