diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-09 10:05:22 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-10 20:07:42 +0200 |
commit | bd98182dbde893a8a809661c70633741bbf63911 (patch) | |
tree | b6291cffa6c2e573a0976a0d70aa467c7a101012 /hugolib/pagecollections.go | |
parent | e88d7989907108b656eccd92bccc076be72a5c03 (diff) |
Implement cascading front matter
Fixes #6041
Diffstat (limited to 'hugolib/pagecollections.go')
-rw-r--r-- | hugolib/pagecollections.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go index 1c8bed9d9..52eb66156 100644 --- a/hugolib/pagecollections.go +++ b/hugolib/pagecollections.go @@ -387,6 +387,7 @@ func (c *PageCollections) clearResourceCacheForPage(page *pageState) { } func (c *PageCollections) assemblePagesMap(s *Site) error { + c.pagesMap = newPagesMap(s) rootSections := make(map[string]bool) @@ -437,18 +438,14 @@ func (c *PageCollections) createWorkAllPages() error { var ( bucketsToRemove []string rootBuckets []*pagesMapBucket + walkErr error ) c.pagesMap.r.Walk(func(s string, v interface{}) bool { bucket := v.(*pagesMapBucket) - var parentBucket *pagesMapBucket + parentBucket := c.pagesMap.parentBucket(s) - if s != "/" { - _, parentv, found := c.pagesMap.r.LongestPrefix(path.Dir(s)) - if !found { - panic(fmt.Sprintf("[BUG] parent bucket not found for %q", s)) - } - parentBucket = parentv.(*pagesMapBucket) + if parentBucket != nil { if !mainSectionsFound && strings.Count(s, "/") == 1 { // Root section @@ -536,6 +533,10 @@ func (c *PageCollections) createWorkAllPages() error { return false }) + if walkErr != nil { + return walkErr + } + c.pagesMap.s.lastmod = siteLastmod if !mainSectionsFound { |