FirstSection
语法
PAGE.FirstSection
返回
page.Page
一个章节是一个顶层内容目录,或者任何带有 _index.md
文件的内容目录。
考虑以下内容结构
content/
├── auctions/
│ ├── 2023-11/
│ │ ├── _index.md <-- first section: auctions
│ │ ├── auction-1.md
│ │ └── auction-2.md <-- first section: auctions
│ ├── 2023-12/
│ │ ├── _index.md
│ │ ├── auction-3.md
│ │ └── auction-4.md
│ ├── _index.md <-- first section: auctions
│ ├── bidding.md
│ └── payment.md <-- first section: auctions
├── books/
│ ├── _index.md <-- first section: books
│ ├── book-1.md
│ └── book-2.md <-- first section: books
├── films/
│ ├── _index.md <-- first section: films
│ ├── film-1.md
│ └── film-2.md <-- first section: films
└── _index.md <-- first section: home
要链接到当前页面所属的顶层章节
<a href="{{ .FirstSection.RelPermalink }}">{{ .FirstSection.LinkTitle }}</a>