HUGO
Menu
GitHub 90498 stars Mastodon

BundleType

Returns the bundle type of the given page, or an empty string if the page is not a page bundle.
Syntax
PAGE.BundleType
Returns
string

Usage

The BundleType method on a Page object returns branch if the page is a branch bundle, leaf if the page is a leaf bundle, and an empty string if the page is not a page bundle.

Examples

Consider this content structure:

content/
├── films/
│   ├── film-1/
│   │   ├── a.jpg
│   │   └── index.md  <-- leaf bundle
│   ├── _index.md     <-- branch bundle
│   ├── b.jpg
│   ├── film-2.md
│   └── film-3.md
└── _index.md         <-- branch bundle

The BundleType method returns these values:

{{ with site.GetPage "/films" }}{{ .BundleType }}{{ end }} → branch
{{ with site.GetPage "/films/film-1" }}{{ .BundleType }}{{ end }} → leaf
{{ with site.GetPage "/films/film-2" }}{{ .BundleType }}{{ end }} → (empty string)