shithub: hugo

Download patch

ref: cfa73050a49b2646fe3557cefa0ed31989b0eeeb
parent: 244e49c0ea9e2d52652dd52943d3df1d8fba6c2b
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Sun Mar 22 09:42:39 EDT 2020

Fix cache reset for a page's collections on server live reload

Fixes #7085

--- a/hugolib/content_map_page.go
+++ b/hugolib/content_map_page.go
@@ -797,6 +797,10 @@
 
 	owner *pageState // The branch node
 
+	*pagesMapBucketPages
+}
+
+type pagesMapBucketPages struct {
 	pagesInit sync.Once
 	pages     page.Pages
 
--- a/hugolib/page__new.go
+++ b/hugolib/page__new.go
@@ -93,7 +93,7 @@
 }
 
 func newPageBucket(p *pageState) *pagesMapBucket {
-	return &pagesMapBucket{owner: p}
+	return &pagesMapBucket{owner: p, pagesMapBucketPages: &pagesMapBucketPages{}}
 }
 
 func newPageFromMeta(
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1492,6 +1492,9 @@
 		s.PageCollections = newPageCollections(s.pageMap)
 		s.pageMap.withEveryBundlePage(func(p *pageState) bool {
 			p.pagePages = &pagePages{}
+			if p.bucket != nil {
+				p.bucket.pagesMapBucketPages = &pagesMapBucketPages{}
+			}
 			p.parent = nil
 			p.Scratcher = maps.NewScratcher()
 			return false