mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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:
parent
4494a01b79
commit
d0d661dffd
3 changed files with 9 additions and 7 deletions
|
@ -569,7 +569,6 @@ func (cfg *BuildCfg) shouldRender(p *pageState) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if p.forceRender {
|
if p.forceRender {
|
||||||
p.forceRender = false
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,6 +576,10 @@ func (cfg *BuildCfg) shouldRender(p *pageState) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.RecentlyVisited[p.RelPermalink()] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.whatChanged != nil && !p.File().IsZero() {
|
if cfg.whatChanged != nil && !p.File().IsZero() {
|
||||||
return cfg.whatChanged.files[p.File().Filename()]
|
return cfg.whatChanged.files[p.File().Filename()]
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,12 +288,10 @@ func (h *HugoSites) render(config *BuildCfg) error {
|
||||||
// needs this set.
|
// needs this set.
|
||||||
s2.rc = &siteRenderingContext{Format: renderFormat}
|
s2.rc = &siteRenderingContext{Format: renderFormat}
|
||||||
|
|
||||||
if !config.PartialReRender {
|
|
||||||
if err := s2.preparePagesForRender(siteRenderContext.sitesOutIdx); err != nil {
|
if err := s2.preparePagesForRender(siteRenderContext.sitesOutIdx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if !config.SkipRender {
|
if !config.SkipRender {
|
||||||
if config.PartialReRender {
|
if config.PartialReRender {
|
||||||
|
|
|
@ -110,8 +110,9 @@ func (s *siteContentProcessor) process(ctx context.Context) error {
|
||||||
panic(fmt.Sprintf("invalid page site: %v vs %v", p.s, s))
|
panic(fmt.Sprintf("invalid page site: %v vs %v", p.s, s))
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.partialBuild {
|
p.forceRender = s.partialBuild
|
||||||
p.forceRender = true
|
|
||||||
|
if p.forceRender {
|
||||||
s.site.replacePage(p)
|
s.site.replacePage(p)
|
||||||
} else {
|
} else {
|
||||||
s.site.addPage(p)
|
s.site.addPage(p)
|
||||||
|
|
Loading…
Reference in a new issue