Skip to content
Permalink
Browse files

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
  • Loading branch information...
bep committed Apr 4, 2019
1 parent 4494a01 commit d0d661dffd19d5ed6efbd4dd2c572bad008bd859
Showing with 9 additions and 7 deletions.
  1. +4 −1 hugolib/hugo_sites.go
  2. +2 −4 hugolib/hugo_sites_build.go
  3. +3 −2 hugolib/pagebundler.go
@@ -569,14 +569,17 @@ func (cfg *BuildCfg) shouldRender(p *pageState) bool {
return false
}
if p.forceRender {
p.forceRender = false
return true
}

if len(cfg.RecentlyVisited) == 0 {
return true
}

if cfg.RecentlyVisited[p.RelPermalink()] {
return true
}

if cfg.whatChanged != nil && !p.File().IsZero() {
return cfg.whatChanged.files[p.File().Filename()]
}
@@ -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
}
}

@@ -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)

0 comments on commit d0d661d

Please sign in to comment.
You can’t perform that action at this time.