CurrentSection
返回給定頁面所在欄目的 Page 對象。
Syntax
PAGE.CurrentSection
Returns
page.Page
section(節)是頂級內容目錄或任何包�?_index.md 文件的內容目錄�
考慮此內容結構:
content/
├── auctions/
│ ├── 2023-11/
│ │ ├── _index.md <-- 當前欄目:2023-11
│ │ ├── auction-1.md
│ │ └── auction-2.md <-- 當前欄目:2023-11
│ ├── 2023-12/
│ │ ├── _index.md
│ │ ├── auction-3.md
│ │ └── auction-4.md
│ ├── _index.md <-- 當前欄目:auctions
│ ├── bidding.md
│ └── payment.md <-- 當前欄目:auctions
├── books/
│ ├── _index.md <-- 當前欄目:books
│ ├── book-1.md
│ └── book-2.md <-- 當前欄目:books
├── films/
│ ├── _index.md <-- 當前欄目:films
│ ├── film-1.md
│ └── film-2.md <-- 當前欄目:films
└── _index.md <-- 當前欄目:home創建指向當前欄目頁面的鏈接:
<a href="{{ .CurrentSection.RelPermalink }}">{{ .CurrentSection.LinkTitle }}</a>