mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix handling of draft term pages
By just removing the term page and all of its page entries. Fixes #12055
This commit is contained in:
parent
9cc65757a1
commit
fc6aabe938
2 changed files with 27 additions and 2 deletions
|
@ -1415,8 +1415,10 @@ func (sa *sitePagesAssembler) applyAggregatesToTaxonomiesAndTerms() error {
|
||||||
if err := p.setMetaPost(cascade); err != nil {
|
if err := p.setMetaPost(cascade); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
if !p.s.shouldBuild(p) {
|
||||||
if err := sa.pageMap.treeTaxonomyEntries.WalkPrefix(
|
sa.pageMap.treePages.Delete(s)
|
||||||
|
sa.pageMap.treeTaxonomyEntries.DeletePrefix(paths.AddTrailingSlash(s))
|
||||||
|
} else if err := sa.pageMap.treeTaxonomyEntries.WalkPrefix(
|
||||||
doctree.LockTypeRead,
|
doctree.LockTypeRead,
|
||||||
paths.AddTrailingSlash(s),
|
paths.AddTrailingSlash(s),
|
||||||
func(ss string, wn *weightedContentNode) (bool, error) {
|
func(ss string, wn *weightedContentNode) (bool, error) {
|
||||||
|
|
|
@ -835,3 +835,26 @@ tags: ["hellO world"]
|
||||||
|
|
||||||
b.AssertFileContent("public/tags/hello-world/index.html", "HellO World|term|tag|tags|hellO world|")
|
b.AssertFileContent("public/tags/hello-world/index.html", "HellO World|term|tag|tags|hellO world|")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTermDraft(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- layouts/_default/list.html --
|
||||||
|
|{{ .Title }}|
|
||||||
|
-- content/p1.md --
|
||||||
|
---
|
||||||
|
title: p1
|
||||||
|
tags: [a]
|
||||||
|
---
|
||||||
|
-- content/tags/a/_index.md --
|
||||||
|
---
|
||||||
|
title: tag-a-title-override
|
||||||
|
draft: true
|
||||||
|
---
|
||||||
|
`
|
||||||
|
|
||||||
|
b := Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileExists("public/tags/a/index.html", false)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue