mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
@@ -332,8 +332,8 @@ func (p *pageState) getLayouts(layouts ...string) ([]string, error) {
|
||||
}
|
||||
|
||||
// This is serialized
|
||||
func (p *pageState) initOutputFormat(idx int) error {
|
||||
if err := p.shiftToOutputFormat(idx); err != nil {
|
||||
func (p *pageState) initOutputFormat(isRenderingSite bool, idx int) error {
|
||||
if err := p.shiftToOutputFormat(isRenderingSite, idx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ func (p *pageState) posOffset(offset int) text.Position {
|
||||
|
||||
// shiftToOutputFormat is serialized. The output format idx refers to the
|
||||
// full set of output formats for all sites.
|
||||
func (p *pageState) shiftToOutputFormat(idx int) error {
|
||||
func (p *pageState) shiftToOutputFormat(isRenderingSite bool, idx int) error {
|
||||
if err := p.initPage(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -715,6 +715,12 @@ func (p *pageState) shiftToOutputFormat(idx int) error {
|
||||
panic(fmt.Sprintf("pageOutput is nil for output idx %d", idx))
|
||||
}
|
||||
|
||||
// Reset any built paginator. This will trigger when re-rendering pages in
|
||||
// server mode.
|
||||
if isRenderingSite && p.pageOutput.paginator != nil && p.pageOutput.paginator.current != nil {
|
||||
p.pageOutput.paginator.reset()
|
||||
}
|
||||
|
||||
if idx > 0 {
|
||||
// Check if we can reuse content from one of the previous formats.
|
||||
for i := idx - 1; i >= 0; i-- {
|
||||
@@ -728,7 +734,7 @@ func (p *pageState) shiftToOutputFormat(idx int) error {
|
||||
|
||||
for _, r := range p.Resources().ByType(pageResourceType) {
|
||||
rp := r.(*pageState)
|
||||
if err := rp.shiftToOutputFormat(idx); err != nil {
|
||||
if err := rp.shiftToOutputFormat(isRenderingSite, idx); err != nil {
|
||||
return errors.Wrap(err, "failed to shift outputformat in Page resource")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user