summaryrefslogtreecommitdiffstats
path: root/hugolib/taxonomy_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-15 09:47:25 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-15 09:52:08 +0200
commit9475f61a377fcf23f910cbfd4ddca59261326665 (patch)
tree94c7bc10cd48511e1f4855403c00d7b23969087f /hugolib/taxonomy_test.go
parentea9261e856c13c1d4ae05fcca08766d410b4b65c (diff)
hugolib: Fix taxonomies vs expired
In Hugo 0.57 we needed to delay the page metadata initialization until we had built the page graph. This introduced a regression in that we now created taxonomy entries for expired pages. This fixes that by moving the "should not build" filter before we assemble the taxonomies. Fixes #6213
Diffstat (limited to 'hugolib/taxonomy_test.go')
-rw-r--r--hugolib/taxonomy_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go
index ccad3a207..294e4f1a0 100644
--- a/hugolib/taxonomy_test.go
+++ b/hugolib/taxonomy_test.go
@@ -320,3 +320,35 @@ Content.
b.AssertFileContent("public/tags/index.html", `<li><a href="http://example.com/tags/rocks-i-say/">Rocks I say!</a> 10</li>`)
}
+
+// Issue 6213
+func TestTaxonomiesNotForDrafts(t *testing.T) {
+ t.Parallel()
+
+ b := newTestSitesBuilder(t)
+ b.WithContent("draft.md", `---
+title: "Draft"
+draft: true
+categories: ["drafts"]
+---
+
+`,
+ "regular.md", `---
+title: "Not Draft"
+categories: ["regular"]
+---
+
+`)
+
+ b.Build(BuildCfg{})
+ s := b.H.Sites[0]
+
+ b.Assert(b.CheckExists("public/categories/regular/index.html"), qt.Equals, true)
+ b.Assert(b.CheckExists("public/categories/drafts/index.html"), qt.Equals, false)
+
+ reg, _ := s.getPageNew(nil, "categories/regular")
+ dra, _ := s.getPageNew(nil, "categories/draft")
+ b.Assert(reg, qt.Not(qt.IsNil))
+ b.Assert(dra, qt.IsNil)
+
+}