shithub: hugo

Download patch

ref: d0d661dffd19d5ed6efbd4dd2c572bad008bd859
parent: 4494a01b794ab785c64c8e93c61ccbfa845bc478
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Apr 4 08:37:55 EDT 2019

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

--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -569,11 +569,14 @@
 		return false
 	}
 	if p.forceRender {
-		p.forceRender = false
 		return true
 	}
 
 	if len(cfg.RecentlyVisited) == 0 {
+		return true
+	}
+
+	if cfg.RecentlyVisited[p.RelPermalink()] {
 		return true
 	}
 
--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -288,10 +288,8 @@
 					// 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
 					}
 				}
 
--- a/hugolib/pagebundler.go
+++ b/hugolib/pagebundler.go
@@ -110,8 +110,9 @@
 				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)