diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-03-24 11:47:05 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-03-24 12:47:42 +0100 |
commit | 523d51948fc20e2afb4721b43203c5ab696ae220 (patch) | |
tree | ac56cd4e2be57f2d7466f8d66205ea645608d525 /hugolib | |
parent | 971b28904bd3d2acf87f40ed796f9b4589ce5922 (diff) |
Fix _build.list.local logic
Fixes #7089
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/content_map.go | 6 | ||||
-rw-r--r-- | hugolib/content_map_page.go | 4 | ||||
-rw-r--r-- | hugolib/disableKinds_test.go | 7 | ||||
-rw-r--r-- | hugolib/page__meta.go | 4 |
4 files changed, 10 insertions, 11 deletions
diff --git a/hugolib/content_map.go b/hugolib/content_map.go index 7b28965ac..3c57fffcf 100644 --- a/hugolib/content_map.go +++ b/hugolib/content_map.go @@ -796,11 +796,11 @@ func newContentTreeFilter(fn func(n *contentNode) bool) contentTreeNodeCallback } var ( - contentTreeNoListFilter = func(s string, n *contentNode) bool { + contentTreeNoListAlwaysFilter = func(s string, n *contentNode) bool { if n.p == nil { return true } - return n.p.m.noList() + return n.p.m.noListAlways() } contentTreeNoRenderFilter = func(s string, n *contentNode) bool { @@ -814,7 +814,7 @@ var ( func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallback) { filter := query.Filter if filter == nil { - filter = contentTreeNoListFilter + filter = contentTreeNoListAlwaysFilter } if query.Prefix != "" { c.WalkPrefix(query.Prefix, func(s string, v interface{}) bool { diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 5607749c9..6be56f3f5 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -304,7 +304,7 @@ func (m *pageMap) createListAllPages() page.Pages { if n.p == nil { panic(fmt.Sprintf("BUG: page not set for %q", s)) } - if contentTreeNoListFilter(s, n) { + if contentTreeNoListAlwaysFilter(s, n) { return false } pages = append(pages, n.p) @@ -613,7 +613,7 @@ type pageMapQuery struct { func (m *pageMap) collectPages(query pageMapQuery, fn func(c *contentNode)) error { if query.Filter == nil { - query.Filter = contentTreeNoListFilter + query.Filter = contentTreeNoListAlwaysFilter } m.pages.WalkQuery(query, func(s string, n *contentNode) bool { diff --git a/hugolib/disableKinds_test.go b/hugolib/disableKinds_test.go index 9ac30442e..87c2b5d3d 100644 --- a/hugolib/disableKinds_test.go +++ b/hugolib/disableKinds_test.go @@ -269,10 +269,9 @@ title: Headless Local Lists Sub sect := getPage(b, ref) b.Assert(sect, qt.Not(qt.IsNil)) b.Assert(getPageInSitePages(b, ref), qt.IsNil) - b.Assert(getPageInSitePages(b, ref+"/headless-local-page"), qt.IsNil) - for i, p := range sect.RegularPages() { - fmt.Println("REG", i, p.(*pageState).sourceRef()) - } + + b.Assert(getPageInSitePages(b, "/headless-local/_index.md"), qt.IsNil) + b.Assert(getPageInSitePages(b, "/headless-local/headless-local-page.md"), qt.IsNil) localPageRef := ref + "/headless-local-page.md" diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go index 87e955103..36c314d9d 100644 --- a/hugolib/page__meta.go +++ b/hugolib/page__meta.go @@ -612,8 +612,8 @@ func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, fron return nil } -func (p *pageMeta) noList() bool { - return !p.buildConfig.ShouldList() +func (p *pageMeta) noListAlways() bool { + return p.buildConfig.List != pagemeta.Always } func (p *pageMeta) getListFilter(local bool) contentTreeNodeCallback { |