mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
971b28904b
commit
523d51948f
5 changed files with 10 additions and 15 deletions
|
@ -796,11 +796,11 @@ func newContentTreeFilter(fn func(n *contentNode) bool) contentTreeNodeCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
contentTreeNoListFilter = func(s string, n *contentNode) bool {
|
contentTreeNoListAlwaysFilter = func(s string, n *contentNode) bool {
|
||||||
if n.p == nil {
|
if n.p == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return n.p.m.noList()
|
return n.p.m.noListAlways()
|
||||||
}
|
}
|
||||||
|
|
||||||
contentTreeNoRenderFilter = func(s string, n *contentNode) bool {
|
contentTreeNoRenderFilter = func(s string, n *contentNode) bool {
|
||||||
|
@ -814,7 +814,7 @@ var (
|
||||||
func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallback) {
|
func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallback) {
|
||||||
filter := query.Filter
|
filter := query.Filter
|
||||||
if filter == nil {
|
if filter == nil {
|
||||||
filter = contentTreeNoListFilter
|
filter = contentTreeNoListAlwaysFilter
|
||||||
}
|
}
|
||||||
if query.Prefix != "" {
|
if query.Prefix != "" {
|
||||||
c.WalkPrefix(query.Prefix, func(s string, v interface{}) bool {
|
c.WalkPrefix(query.Prefix, func(s string, v interface{}) bool {
|
||||||
|
|
|
@ -304,7 +304,7 @@ func (m *pageMap) createListAllPages() page.Pages {
|
||||||
if n.p == nil {
|
if n.p == nil {
|
||||||
panic(fmt.Sprintf("BUG: page not set for %q", s))
|
panic(fmt.Sprintf("BUG: page not set for %q", s))
|
||||||
}
|
}
|
||||||
if contentTreeNoListFilter(s, n) {
|
if contentTreeNoListAlwaysFilter(s, n) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
pages = append(pages, n.p)
|
pages = append(pages, n.p)
|
||||||
|
@ -613,7 +613,7 @@ type pageMapQuery struct {
|
||||||
|
|
||||||
func (m *pageMap) collectPages(query pageMapQuery, fn func(c *contentNode)) error {
|
func (m *pageMap) collectPages(query pageMapQuery, fn func(c *contentNode)) error {
|
||||||
if query.Filter == nil {
|
if query.Filter == nil {
|
||||||
query.Filter = contentTreeNoListFilter
|
query.Filter = contentTreeNoListAlwaysFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
m.pages.WalkQuery(query, func(s string, n *contentNode) bool {
|
m.pages.WalkQuery(query, func(s string, n *contentNode) bool {
|
||||||
|
|
|
@ -269,10 +269,9 @@ title: Headless Local Lists Sub
|
||||||
sect := getPage(b, ref)
|
sect := getPage(b, ref)
|
||||||
b.Assert(sect, qt.Not(qt.IsNil))
|
b.Assert(sect, qt.Not(qt.IsNil))
|
||||||
b.Assert(getPageInSitePages(b, ref), 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() {
|
b.Assert(getPageInSitePages(b, "/headless-local/_index.md"), qt.IsNil)
|
||||||
fmt.Println("REG", i, p.(*pageState).sourceRef())
|
b.Assert(getPageInSitePages(b, "/headless-local/headless-local-page.md"), qt.IsNil)
|
||||||
}
|
|
||||||
|
|
||||||
localPageRef := ref + "/headless-local-page.md"
|
localPageRef := ref + "/headless-local-page.md"
|
||||||
|
|
||||||
|
|
|
@ -612,8 +612,8 @@ func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, fron
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pageMeta) noList() bool {
|
func (p *pageMeta) noListAlways() bool {
|
||||||
return !p.buildConfig.ShouldList()
|
return p.buildConfig.List != pagemeta.Always
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pageMeta) getListFilter(local bool) contentTreeNodeCallback {
|
func (p *pageMeta) getListFilter(local bool) contentTreeNodeCallback {
|
||||||
|
|
|
@ -71,10 +71,6 @@ func (b BuildConfig) IsZero() bool {
|
||||||
return !b.set
|
return !b.set
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BuildConfig) ShouldList() bool {
|
|
||||||
return b.List == Always || b.List == ListLocally
|
|
||||||
}
|
|
||||||
|
|
||||||
func DecodeBuildConfig(m interface{}) (BuildConfig, error) {
|
func DecodeBuildConfig(m interface{}) (BuildConfig, error) {
|
||||||
b := defaultBuildConfig
|
b := defaultBuildConfig
|
||||||
if m == nil {
|
if m == nil {
|
||||||
|
|
Loading…
Reference in a new issue