From c7acc318b5f48bad1af18f134d0e9308879abd17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 6 Mar 2016 16:33:32 +0100 Subject: [PATCH] Add some missing resets on rebuild Fixes #1928 Fixes #1929 --- hugolib/site.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hugolib/site.go b/hugolib/site.go index 93128bbbf..02a310f32 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -469,6 +469,9 @@ func (s *Site) ReBuild(events []fsnotify.Event) error { 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 { @@ -1303,6 +1306,17 @@ func (s *Site) assembleTaxonomies() { 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() { for i, p := range s.Pages { s.Sections.Add(p.Section(), WeightedPage{s.Pages[i].Weight, s.Pages[i]}, s.Info.preserveTaxonomyNames)