hugolib: Re-work "fast render" logic in the new flow

Note that this fixes some "live reload" issues recently introduced in non-released code.

Closes #5811
See #5784
This commit is contained in:
Bjørn Erik Pedersen 2019-04-04 12:37:55 +02:00
parent 4494a01b79
commit d0d661dffd
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
3 changed files with 9 additions and 7 deletions

View file

@ -569,7 +569,6 @@ func (cfg *BuildCfg) shouldRender(p *pageState) bool {
return false
}
if p.forceRender {
p.forceRender = false
return true
}
@ -577,6 +576,10 @@ func (cfg *BuildCfg) shouldRender(p *pageState) bool {
return true
}
if cfg.RecentlyVisited[p.RelPermalink()] {
return true
}
if cfg.whatChanged != nil && !p.File().IsZero() {
return cfg.whatChanged.files[p.File().Filename()]
}

View file

@ -288,10 +288,8 @@ func (h *HugoSites) render(config *BuildCfg) error {
// needs this set.
s2.rc = &siteRenderingContext{Format: renderFormat}
if !config.PartialReRender {
if err := s2.preparePagesForRender(siteRenderContext.sitesOutIdx); err != nil {
return err
}
if err := s2.preparePagesForRender(siteRenderContext.sitesOutIdx); err != nil {
return err
}
}

View file

@ -110,8 +110,9 @@ func (s *siteContentProcessor) process(ctx context.Context) error {
panic(fmt.Sprintf("invalid page site: %v vs %v", p.s, s))
}
if s.partialBuild {
p.forceRender = true
p.forceRender = s.partialBuild
if p.forceRender {
s.site.replacePage(p)
} else {
s.site.addPage(p)