summaryrefslogtreecommitdiffstats
path: root/hugolib/taxonomy_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-29 10:14:37 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-12-30 18:50:09 +0100
commit4bae8b04aadd72d298bf2dd1bb1430806bf2869c (patch)
tree72532b6d9f3288ab10674c486d650e37b3249184 /hugolib/taxonomy_test.go
parent0584432b078f1e3a488ad4f27f39edac0557e042 (diff)
Revert " Fix handling of taxonomy terms containing slashes"
See #4090 See #5571 This reverts commit fff132537b4094221f4f099e2251f3cda613060f.
Diffstat (limited to 'hugolib/taxonomy_test.go')
-rw-r--r--hugolib/taxonomy_test.go43
1 files changed, 37 insertions, 6 deletions
diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go
index ec55dc428..6ea397173 100644
--- a/hugolib/taxonomy_test.go
+++ b/hugolib/taxonomy_test.go
@@ -45,9 +45,8 @@ func TestByCountOrderOfTaxonomies(t *testing.T) {
st = append(st, t.Name)
}
- expect := []string{"a", "b", "c", "x/y"}
- if !reflect.DeepEqual(st, expect) {
- t.Fatalf("ordered taxonomies do not match %v. Got: %s", expect, st)
+ if !reflect.DeepEqual(st, []string{"a", "b", "c"}) {
+ t.Fatalf("ordered taxonomies do not match [a, b, c]. Got: %s", st)
}
}
@@ -69,10 +68,8 @@ func doTestTaxonomiesWithAndWithoutContentFile(t *testing.T, preserveTaxonomyNam
baseURL = "http://example.com/blog"
preserveTaxonomyNames = %t
uglyURLs = %t
-
paginate = 1
defaultContentLanguage = "en"
-
[Taxonomies]
tag = "tags"
category = "categories"
@@ -80,7 +77,6 @@ other = "others"
empty = "empties"
permalinked = "permalinkeds"
subcats = "subcats"
-
[permalinks]
permalinkeds = "/perma/:slug/"
subcats = "/subcats/:slug/"
@@ -243,3 +239,38 @@ subcats:
th.assertFileContent(pathFunc("public/empties/index.html"), "Terms List", "Empties")
}
+
+// https://github.com/gohugoio/hugo/issues/5513
+func TestTaxonomyPathSeparation(t *testing.T) {
+ t.Parallel()
+
+ config := `
+baseURL = "https://example.com"
+[taxonomies]
+"news/tag" = "news/tags"
+"news/category" = "news/categories"
+`
+
+ pageContent := `
++++
+title = "foo"
+"news/categories" = ["a", "b", "c"]
++++
+Content.
+`
+
+ b := newTestSitesBuilder(t)
+ b.WithConfigFile("toml", config)
+ b.WithContent("page.md", pageContent)
+ b.WithContent("news/categories/b/_index.md", `
+---
+title: "This is B"
+---
+`)
+
+ b.CreateSites().Build(BuildCfg{})
+
+ b.AssertFileContent("public/news/categories/index.html", "Taxonomy Term Page 1|News/Categories|Hello|https://example.com/news/categories/|")
+ b.AssertFileContent("public/news/categories/a/index.html", "Taxonomy List Page 1|A|Hello|https://example.com/news/categories/a/|")
+ b.AssertFileContent("public/news/categories/b/index.html", "Taxonomy List Page 1|This is B|Hello|https://example.com/news/categories/b/|")
+}