shithub: hugo

Download patch

ref: c7acc318b5f48bad1af18f134d0e9308879abd17
parent: eaba04e82bdfc5d4c29e970f11b4aab9cc0efeaa
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Mar 6 11:33:32 EST 2016

Add some missing resets on rebuild

Fixes #1928
Fixes #1929

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -469,6 +469,9 @@
 		s.ReadDataFromSourceFS()
 	}
 
+	// we reuse the state, so have to do some cleanup before we can rebuild.
+	s.resetPageBuildState()
+
 	// If a content file changes, we need to reload only it and re-render the entire site.
 	if len(sourceChanged) > 0 {
 
@@ -1301,6 +1304,17 @@
 
 	s.Info.Taxonomies = s.Taxonomies
 	s.Info.Sections = s.Sections
+}
+
+// Prepare pages for a new full build.
+func (s *Site) resetPageBuildState() {
+
+	s.Info.paginationPageCount = 0
+
+	for _, p := range s.Pages {
+		p.scratch = newScratch()
+
+	}
 }
 
 func (s *Site) assembleSections() {