mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
42d8dfc8c8
commit
b8b8436fcc
2 changed files with 17 additions and 9 deletions
|
@ -416,6 +416,7 @@ type BuildCfg struct {
|
||||||
// a Page: If it is recently visited (the home pages will always be in this set) or changed.
|
// a Page: If it is recently visited (the home pages will always be in this set) or changed.
|
||||||
// Note that a page does not have to have a content page / file.
|
// Note that a page does not have to have a content page / file.
|
||||||
// For regular builds, this will allways return true.
|
// For regular builds, this will allways return true.
|
||||||
|
// TODO(bep) rename/work this.
|
||||||
func (cfg *BuildCfg) shouldRender(p *Page) bool {
|
func (cfg *BuildCfg) shouldRender(p *Page) bool {
|
||||||
if p.forceRender {
|
if p.forceRender {
|
||||||
p.forceRender = false
|
p.forceRender = false
|
||||||
|
@ -427,6 +428,9 @@ func (cfg *BuildCfg) shouldRender(p *Page) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.RecentlyVisited[p.RelPermalink()] {
|
if cfg.RecentlyVisited[p.RelPermalink()] {
|
||||||
|
if cfg.PartialReRender {
|
||||||
|
_ = p.initMainOutputFormat()
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,15 +648,13 @@ func (h *HugoSites) setupTranslations() {
|
||||||
|
|
||||||
func (s *Site) preparePagesForRender(start bool) error {
|
func (s *Site) preparePagesForRender(start bool) error {
|
||||||
for _, p := range s.Pages {
|
for _, p := range s.Pages {
|
||||||
p.setContentInit(start)
|
if err := p.prepareForRender(start); err != nil {
|
||||||
if err := p.initMainOutputFormat(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range s.headlessPages {
|
for _, p := range s.headlessPages {
|
||||||
p.setContentInit(start)
|
if err := p.prepareForRender(start); err != nil {
|
||||||
if err := p.initMainOutputFormat(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ func (p *Page) initContent() {
|
||||||
go func() {
|
go func() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
err = p.prepareForRender()
|
err = p.prepareContent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c <- err
|
c <- err
|
||||||
return
|
return
|
||||||
|
@ -1142,11 +1142,17 @@ func (p *Page) subResourceTargetPathFactory(base string) string {
|
||||||
return path.Join(p.relTargetPathBase, base)
|
return path.Join(p.relTargetPathBase, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) initMainOutputFormat() error {
|
// Prepare this page for rendering for a new site. The flag start is set
|
||||||
if p.mainPageOutput != nil {
|
// for the first site and output format.
|
||||||
return nil
|
func (p *Page) prepareForRender(start bool) error {
|
||||||
|
p.setContentInit(start)
|
||||||
|
if start {
|
||||||
|
return p.initMainOutputFormat()
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Page) initMainOutputFormat() error {
|
||||||
outFormat := p.outputFormats[0]
|
outFormat := p.outputFormats[0]
|
||||||
pageOutput, err := newPageOutput(p, false, false, outFormat)
|
pageOutput, err := newPageOutput(p, false, false, outFormat)
|
||||||
|
|
||||||
|
@ -1193,7 +1199,7 @@ func (p *Page) setContentInit(start bool) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) prepareForRender() error {
|
func (p *Page) prepareContent() error {
|
||||||
s := p.s
|
s := p.s
|
||||||
|
|
||||||
// If we got this far it means that this is either a new Page pointer
|
// If we got this far it means that this is either a new Page pointer
|
||||||
|
|
Loading…
Reference in a new issue