summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_sites.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.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.go')
-rw-r--r--hugolib/hugo_sites.go33
1 files changed, 3 insertions, 30 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index e375b0eba..a5bb664c0 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -559,41 +559,14 @@ func (h *HugoSites) setupTranslations() {
}
}
-func (s *Site) preparePagesForRender(cfg *BuildCfg) {
-
- pageChan := make(chan *Page)
- wg := &sync.WaitGroup{}
-
- numWorkers := getGoMaxProcs() * 4
-
- for i := 0; i < numWorkers; i++ {
- wg.Add(1)
- go func(pages <-chan *Page, wg *sync.WaitGroup) {
- defer wg.Done()
- for p := range pages {
- p.setContentInit(cfg)
-
- // In most cases we could delay the content init until rendering time,
- // but there could be use cases where the templates would depend
- // on state set in the shortcodes (.Page.Scratch.Set), so we
- // need to do this early. This will do the needed recursion.
- p.initContent()
- }
- }(pageChan, wg)
- }
-
+func (s *Site) preparePagesForRender(start bool) {
for _, p := range s.Pages {
- pageChan <- p
+ p.setContentInit(start)
}
for _, p := range s.headlessPages {
- pageChan <- p
+ p.setContentInit(start)
}
-
- close(pageChan)
-
- wg.Wait()
-
}
// Pages returns all pages for all sites.