Skip to content

Commit

Permalink
hugolib: Fix "borrow content from another language" issue
Browse files Browse the repository at this point in the history
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 gohugoio#4986
  • Loading branch information
bep committed Jul 23, 2018
1 parent 3a6784b commit 0ee196e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 0ee196e

Please sign in to comment.