diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-03-07 08:25:34 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-03-07 09:50:50 +0100 |
commit | 0567a3e6f1c03be45ee3dc9ae79e6f791dfa289f (patch) | |
tree | 2cff69c9883f1524779d743d13a74ed2ba76661c | |
parent | 632ad74fc5948786a53740c2a087a12eb2466908 (diff) | |
download | hugo-0567a3e6f1c03be45ee3dc9ae79e6f791dfa289f.tar.gz hugo-0567a3e6f1c03be45ee3dc9ae79e6f791dfa289f.zip |
Fix taxonomy kind template lookup issue
Fixes #12193
-rw-r--r-- | hugolib/page__new.go | 2 | ||||
-rw-r--r-- | hugolib/taxonomy_test.go | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/hugolib/page__new.go b/hugolib/page__new.go index 9dd2f2cdf..e14de6925 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -145,9 +145,11 @@ func (h *HugoSites) newPage(m *pageMeta) (*pageState, *paths.Path, error) { // Either a taxonomy or a term. if tc.pluralTreeKey == m.Path() { m.pageConfig.Kind = kinds.KindTaxonomy + m.singular = tc.singular } else { m.pageConfig.Kind = kinds.KindTerm m.term = m.pathInfo.Unnormalized().BaseNameNoIdentifier() + m.singular = tc.singular } } } else if m.f != nil { diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go index 5a48df3b7..e8bf54758 100644 --- a/hugolib/taxonomy_test.go +++ b/hugolib/taxonomy_test.go @@ -911,3 +911,28 @@ title: tag-a-title-override b.AssertFileContent("public/tags/a/index.html", "Tag: tag-a-title-override|") } + +func TestTaxonomyLookupIssue12193(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap'] +[taxonomies] +author = 'authors' +-- layouts/_default/list.html -- +{{ .Title }}| +-- layouts/_default/author.terms.html -- +layouts/_default/author.terms.html +-- content/authors/_index.md -- +--- +title: Authors Page +--- +` + + b := Test(t, files) + + b.AssertFileExists("public/index.html", true) + b.AssertFileExists("public/authors/index.html", true) + b.AssertFileContent("public/authors/index.html", "layouts/_default/author.terms.html") // failing test +} |