mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
hugolib: Handle shortcode per output format
This commit allows shortcode per output format, a typical use case would be the special AMP media tags. Note that this will only re-render the "overridden" shortcodes and only in pages where these are used, so performance in the normal case should not suffer. Closes #3220
This commit is contained in:
@@ -77,8 +77,6 @@ func pageRenderer(s *Site, pages <-chan *Page, results chan<- error, wg *sync.Wa
|
||||
if i == 0 {
|
||||
pageOutput, err = newPageOutput(page, false, outFormat)
|
||||
page.mainPageOutput = pageOutput
|
||||
} else {
|
||||
pageOutput, err = page.mainPageOutput.copyWithFormat(outFormat)
|
||||
}
|
||||
|
||||
if outFormat != page.s.rc.Format {
|
||||
@@ -86,6 +84,10 @@ func pageRenderer(s *Site, pages <-chan *Page, results chan<- error, wg *sync.Wa
|
||||
continue
|
||||
}
|
||||
|
||||
if pageOutput == nil {
|
||||
pageOutput, err = page.mainPageOutput.copyWithFormat(outFormat)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
s.Log.ERROR.Printf("Failed to create output page for type %q for page %q: %s", outFormat.Name, page, err)
|
||||
continue
|
||||
|
Reference in New Issue
Block a user