mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Add headless bundle support
This commit adds support for `headless bundles` for the `index` bundle type. So: ```toml headless = true ``` In front matter means that * 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 ...` The use cases are many: * Shared media galleries * Reusable page content "snippets" * ... Fixes #4311
This commit is contained in:
@@ -508,7 +508,11 @@ func (h *HugoSites) setupTranslations() {
|
||||
shouldBuild := p.shouldBuild()
|
||||
s.updateBuildStats(p)
|
||||
if shouldBuild {
|
||||
s.Pages = append(s.Pages, p)
|
||||
if p.headless {
|
||||
s.headlessPages = append(s.headlessPages, p)
|
||||
} else {
|
||||
s.Pages = append(s.Pages, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,6 +564,10 @@ func (s *Site) preparePagesForRender(cfg *BuildCfg) {
|
||||
pageChan <- p
|
||||
}
|
||||
|
||||
for _, p := range s.headlessPages {
|
||||
pageChan <- p
|
||||
}
|
||||
|
||||
close(pageChan)
|
||||
|
||||
wg.Wait()
|
||||
|
Reference in New Issue
Block a user