mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
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
This commit is contained in:
@@ -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 i, rf := range s.renderFormats {
|
||||
s.rc = &siteRenderingContext{Format: rf}
|
||||
}
|
||||
|
||||
s.preparePagesForRender(config)
|
||||
for _, s := range h.Sites {
|
||||
for i, rf := range s.renderFormats {
|
||||
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}
|
||||
|
||||
isRenderingSite := s == s2
|
||||
|
||||
s2.preparePagesForRender(isRenderingSite && i == 0)
|
||||
|
||||
}
|
||||
|
||||
if !config.SkipRender {
|
||||
if err := s.render(config, i); err != nil {
|
||||
|
Reference in New Issue
Block a user