LockType: doctree.LockTypeRead,
Handle: func(s string, n contentNodeI, match doctree.DimensionFlag) (bool, error) {
p := n.(*pageState)
- plural := p.Section()
switch p.Kind() {
case kinds.KindTerm:
- taxonomy := m.s.taxonomies[plural]
+ taxonomy := m.s.taxonomies[viewName.plural]
if taxonomy == nil {
- return true, fmt.Errorf("missing taxonomy: %s", plural)
+ return true, fmt.Errorf("missing taxonomy: %s", viewName.plural)
}
k := strings.ToLower(p.m.term)
err := m.treeTaxonomyEntries.WalkPrefix(
`
Test(t, files)
}
+
+func TestTaxonomiesSpaceInName(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+[taxonomies]
+authors = 'book authors'
+-- content/p1.md --
+---
+title: Good Omens
+book authors:
+ - Neil Gaiman
+ - Terry Pratchett
+---
+-- layouts/index.html --
+{{- $taxonomy := "book authors" }}
+Len Book Authors: {{ len (index .Site.Taxonomies $taxonomy) }}
+`
+ b := Test(t, files)
+
+ b.AssertFileContent("public/index.html", "Len Book Authors: 2")
+}