aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-17 15:17:13 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-17 18:12:25 +0100
commitfc6aabe9380017fab34105f9aed4c408c57e98ec (patch)
treeb545ce667ff3c817ca9f364120c961e05854299d
parent9cc65757a137206fda2d49e8975ae36b01017812 (diff)
downloadhugo-fc6aabe9380017fab34105f9aed4c408c57e98ec.tar.gz
hugo-fc6aabe9380017fab34105f9aed4c408c57e98ec.zip
Fix handling of draft term pages
By just removing the term page and all of its page entries. Fixes #12055
-rw-r--r--hugolib/content_map_page.go6
-rw-r--r--hugolib/taxonomy_test.go23
2 files changed, 27 insertions, 2 deletions
diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go
index 70e8a0bb6..d9cbddfba 100644
--- a/hugolib/content_map_page.go
+++ b/hugolib/content_map_page.go
@@ -1415,8 +1415,10 @@ func (sa *sitePagesAssembler) applyAggregatesToTaxonomiesAndTerms() error {
if err := p.setMetaPost(cascade); err != nil {
return false, err
}
-
- if err := sa.pageMap.treeTaxonomyEntries.WalkPrefix(
+ if !p.s.shouldBuild(p) {
+ sa.pageMap.treePages.Delete(s)
+ sa.pageMap.treeTaxonomyEntries.DeletePrefix(paths.AddTrailingSlash(s))
+ } else if err := sa.pageMap.treeTaxonomyEntries.WalkPrefix(
doctree.LockTypeRead,
paths.AddTrailingSlash(s),
func(ss string, wn *weightedContentNode) (bool, error) {
diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go
index 17e1b6cd4..8c29b781e 100644
--- a/hugolib/taxonomy_test.go
+++ b/hugolib/taxonomy_test.go
@@ -835,3 +835,26 @@ 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)
+}