FirstSection
Returns the Page object of the top-level section of which the given page is a descendant.
Syntax
PAGE.FirstSection
Returns
page.Page
A section is a top-level content directory or any content directory containing an _index.md file.
When called on the home page, the FirstSection method returns the Page object of the home page itself.
Consider this content structure:
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: homeTo link to the top-level section of which the current page is a descendant:
<a href="{{ .FirstSection.RelPermalink }}">{{ .FirstSection.LinkTitle }}</a>Last updated:
March 8, 2025
:
content: Replace note shortcode calls with blockquote alerts (c540e6d29)
Improve this page
