summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-05 09:57:58 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-05 16:11:11 +0200
commit658e11ebaa94de219f941699d119a97a18301eea (patch)
tree76330777138b792bac1dfcf05e9948d9f5839bcc /hugolib
parente0a882fd3b9825dc9a95b83d72fc330dcbbbcce9 (diff)
Localize all the GroupBy*Date methods
Fixes #9745
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/hugo_sites.go3
-rw-r--r--hugolib/hugo_sites_build.go1
-rw-r--r--hugolib/site.go5
3 files changed, 9 insertions, 0 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index 9b27ae5e3..09e1a331a 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -73,6 +73,9 @@ type HugoSites struct {
// Render output formats for all sites.
renderFormats output.Formats
+ // The currently rendered Site.
+ currentSite *Site
+
*deps.Deps
gitInfo *gitInfo
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go
index 6f3955b80..bf52277a9 100644
--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -289,6 +289,7 @@ func (h *HugoSites) render(config *BuildCfg) error {
i := 0
for _, s := range h.Sites {
+ h.currentSite = s
for siteOutIdx, renderFormat := range s.renderFormats {
siteRenderContext.outIdx = siteOutIdx
siteRenderContext.sitesOutIdx = i
diff --git a/hugolib/site.go b/hugolib/site.go
index 59326cab6..efa936830 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -738,6 +738,11 @@ func (s *SiteInfo) Sites() page.Sites {
return s.s.h.siteInfos()
}
+// Current returns the currently rendered Site.
+func (s *SiteInfo) Current() page.Site {
+ return s.s.h.currentSite.Info
+}
+
func (s *SiteInfo) String() string {
return fmt.Sprintf("Site(%q)", s.title)
}