Add site.Store and hugo.Store and Shortcode.Store

Closes #13021
This commit is contained in:
Bjørn Erik Pedersen
2024-11-13 11:07:32 +01:00
parent 3477d9fcec
commit a7df536a52
7 changed files with 108 additions and 13 deletions

View File

@@ -95,6 +95,7 @@ type Site struct {
language *langs.Language
languagei int
pageMap *pageMap
store *maps.Scratch
// The owning container.
h *HugoSites
@@ -248,6 +249,7 @@ func NewHugoSites(cfg deps.DepsCfg) (*HugoSites, error) {
language: language,
languagei: i,
frontmatterHandler: frontmatterHandler,
store: maps.NewScratch(),
}
if i == 0 {
@@ -614,6 +616,10 @@ func (s *Site) AllRegularPages() page.Pages {
return s.h.RegularPages()
}
func (s *Site) Store() *maps.Scratch {
return s.store
}
func (s *Site) CheckReady() {
if s.state != siteStateReady {
panic("this method cannot be called before the site is fully initialized")