From 0ee196e03d194941c7f30e84e81feb64e2c1ebcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 23 Jul 2018 15:40:04 +0200 Subject: [PATCH] hugolib: Fix "borrow content from another language" issue If a content file contains shortcode(s), we have logic in place to re-render it per output format. We also have logic in place that avoids making a copy of the content used for this process if we don't need it. This was before this commit limited to server mode and if the page should be output to multiple formats. But there is a third case: If a site (language) borrows and renders `.Content` from another language. This would, before this commit, behave oddly for content with shortcodes. Fixes #4986 --- hugolib/page.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugolib/page.go b/hugolib/page.go index f45257c9d32..c00070c9aea 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -1249,10 +1249,10 @@ func (p *Page) prepareForRender() error { // or a template or similar has changed so wee need to do a rerendering // of the shortcodes etc. - // If in watch mode or if we have multiple output formats, + // If in watch mode or if we have multiple sites or output formats, // we need to keep the original so we can // potentially repeat this process on rebuild. - needsACopy := s.running() || len(p.outputFormats) > 1 + needsACopy := s.running() || len(s.owner.Sites) > 1 || len(p.outputFormats) > 1 var workContentCopy []byte if needsACopy { workContentCopy = make([]byte, len(p.workContent))