diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-06-08 11:52:22 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-06-23 11:25:47 +0200 |
commit | 6cd0784e447f18e009cbbf30de471e486f7cf356 (patch) | |
tree | 0684d05d7e487ebe93463636ed8b5a1bb78e4704 /resources/page | |
parent | 8731d8822216dd3c7587769e3cf5d98690717b0c (diff) | |
download | hugo-6cd0784e447f18e009cbbf30de471e486f7cf356.tar.gz hugo-6cd0784e447f18e009cbbf30de471e486f7cf356.zip |
Implement defer
Closes #8086
Closes #12589
Diffstat (limited to 'resources/page')
-rw-r--r-- | resources/page/site.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/resources/page/site.go b/resources/page/site.go index 56f438cb6..9f7871a02 100644 --- a/resources/page/site.go +++ b/resources/page/site.go @@ -134,6 +134,12 @@ type Site interface { // Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. RSSLink() template.URL + + // For internal use only. + // This will panic if the site is not fully initialized. + // This is typically used to inform the user in the content adapter templates, + // as these are executed before all the page collections etc. are ready to use. + CheckReady() } // Sites represents an ordered list of sites (languages). @@ -326,6 +332,11 @@ func (s *siteWrapper) ForEeachIdentityByName(name string, f func(identity.Identi s.s.(identity.ForEeachIdentityByNameProvider).ForEeachIdentityByName(name, f) } +// For internal use only. +func (s *siteWrapper) CheckReady() { + s.s.CheckReady() +} + type testSite struct { h hugo.HugoInfo l *langs.Language @@ -480,6 +491,9 @@ func (s testSite) RSSLink() template.URL { return "" } +func (s testSite) CheckReady() { +} + // NewDummyHugoSite creates a new minimal test site. func NewDummyHugoSite(conf config.AllProvider) Site { return testSite{ |