summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_sites_build.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-04-24 05:57:33 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-04-25 08:56:46 +0200
commit288c39643906b4194a0a6acfbaf87cb0fbdeb361 (patch)
tree15587fe16af04ccc881c7dbccce2800da3c7d9ea /hugolib/hugo_sites_build.go
parent44e47478d035e835ea7a7ac57217557baeac8c5b (diff)
hugolib: Fix some shortcode vs .Content corner cases
This is a follow-up to #4632. There were some assumptions in that implementation that did not hold water in all situations. This commit simplifies the content lazy initalization making it more robust. Fixes #4664
Diffstat (limited to 'hugolib/hugo_sites_build.go')
-rw-r--r--hugolib/hugo_sites_build.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go
index dcff4b3b2..0421c7925 100644
--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -222,10 +222,21 @@ func (h *HugoSites) assemble(config *BuildCfg) error {
func (h *HugoSites) render(config *BuildCfg) error {
for _, s := range h.Sites {
s.initRenderFormats()
+ }
+
+ for _, s := range h.Sites {
for i, rf := range s.renderFormats {
- s.rc = &siteRenderingContext{Format: rf}
+ for _, s2 := range h.Sites {
+ // We render site by site, but since the content is lazily rendered
+ // and a site can "borrow" content from other sites, every site
+ // needs this set.
+ s2.rc = &siteRenderingContext{Format: rf}
- s.preparePagesForRender(config)
+ isRenderingSite := s == s2
+
+ s2.preparePagesForRender(isRenderingSite && i == 0)
+
+ }
if !config.SkipRender {
if err := s.render(config, i); err != nil {