Page using the Headless Page Bundle X
tags:
page-bundles
headless
layout
Layout file:
headless-bundle-single.html
This is a regular page. Below content is fetched from the headless
page bundle headless-page-bundle-x
.
Content from Headless Bundle Index page
Headless Page Bundle Index Page
This is a headless page bundle. This feature was introduced in this
commit, and available in Hugo v0.35+.
As this bundle is headless, the index page of this bundle (this
page!) will not be published anywhere:
- It will have no
Permalink
and no rendered HTML in public/
.
- It will not be part of
.Site.RegularPages
, etc.
But you can get it by .Site.GetPage ...
. Here is an example (ref):
{{ $headless := .Site.GetPage "page" "some-headless-page" }}
{{ $reusablePages := $headless.Resources.Match "sidebar-content*" }}
{{ range $reusablePages }}
{{ .Title }}
{{ end }}
There are many use cases of such headless page bundles:
- Shared media galleries
- Reusable page content “snippets”
Headless Bundle Index Page Params (Debug)
Key | Type | Value |
draft | bool |
false
|
headless | bool |
true
|
iscjklanguage | bool |
false
|
lastmod | time.Time |
2018-03-14 14:27:58 -0400 -0400
|
tags | []string |
"page-bundles"
"headless"
|
title | string |
"Headless Page Bundle Index Page"
|
Content from Headless Bundle page Resources
Bundled page bar in the headless bundle
“Bar” page in Headless Page Bundle.
Bundled page foo in the headless bundle
“Foo” page in Headless Page Bundle.
Bundled page zoo in the headless bundle
“Zoo” page in Headless Page Bundle.
Headless Bundle Resources (Debug)
Page Variable | Value |
Name |
"bar.md"
|
Title |
"Bundled page bar in the headless bundle"
|
ResourceType |
"page"
|
Kind |
"page"
|
Section |
"bundles"
|
Draft |
false
|
Type |
"bundles"
|
Layout |
""
|
Permalink |
""
|
RelPermalink |
""
|
Data |
page.Data{} (type:page.Data) |
|
NextPage | None |
PrevPage | None |
NextInSection | None |
PrevInSection | None |
Page Variable | Value |
Name |
"foo.md"
|
Title |
"Bundled page foo in the headless bundle"
|
ResourceType |
"page"
|
Kind |
"page"
|
Section |
"bundles"
|
Draft |
false
|
Type |
"bundles"
|
Layout |
""
|
Permalink |
""
|
RelPermalink |
""
|
Data |
page.Data{} (type:page.Data) |
|
NextPage | None |
PrevPage | None |
NextInSection | None |
PrevInSection | None |
Page Variable | Value |
Name |
"zoo.md"
|
Title |
"Bundled page zoo in the headless bundle"
|
ResourceType |
"page"
|
Kind |
"page"
|
Section |
"bundles"
|
Draft |
false
|
Type |
"bundles"
|
Layout |
""
|
Permalink |
""
|
RelPermalink |
""
|
Data |
page.Data{} (type:page.Data) |
|
NextPage | None |
PrevPage | None |
NextInSection | None |
PrevInSection | None |
Page (Debug)
Page Params (Debug)
Key | Type | Value |
draft | bool |
false
|
iscjklanguage | bool |
false
|
lastmod | time.Time |
2021-12-14 15:26:44 -0500 -0500
|
layout | string |
"headless-bundle-single"
|
tags | []string |
"page-bundles"
"headless"
"layout"
|
title | string |
"Page using the Headless Page Bundle X"
|
File Object (Debug)
FileInfo Variable | Value |
UniqueID |
"dab0f5a61d0cd9b1f992bb21b3000032"
|
BaseFileName |
"page-using-headless-page-bundle"
|
TranslationBaseName |
"page-using-headless-page-bundle"
|
Lang |
"en"
|
Section |
"posts"
|
LogicalName |
"page-using-headless-page-bundle.md"
|
Dir |
"posts/"
|
Ext |
"md"
|
Path |
"posts/page-using-headless-page-bundle.md"
|