mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Fix term template lookup when its backed by a content file
Closes #12146
This commit is contained in:
@@ -1552,8 +1552,10 @@ func (sa *sitePagesAssembler) assembleTermsAndTranslations() error {
|
|||||||
}
|
}
|
||||||
pages.InsertIntoValuesDimension(pi.Base(), n)
|
pages.InsertIntoValuesDimension(pi.Base(), n)
|
||||||
term = pages.Get(pi.Base())
|
term = pages.Get(pi.Base())
|
||||||
} else if term.(*pageState).m.term != v {
|
} else {
|
||||||
term.(*pageState).m.term = v
|
m := term.(*pageState).m
|
||||||
|
m.term = v
|
||||||
|
m.singular = viewName.singular
|
||||||
}
|
}
|
||||||
|
|
||||||
if s == "" {
|
if s == "" {
|
||||||
|
@@ -885,3 +885,29 @@ build:
|
|||||||
b.AssertFileExists("public/tags/a/index.html", false)
|
b.AssertFileExists("public/tags/a/index.html", false)
|
||||||
b.AssertFileContent("public/index.html", "|0|")
|
b.AssertFileContent("public/index.html", "|0|")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTaxonomiesTermLookup(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "https://example.com"
|
||||||
|
[taxonomies]
|
||||||
|
tag = "tags"
|
||||||
|
-- content/_index.md --
|
||||||
|
---
|
||||||
|
title: "Home"
|
||||||
|
tags: ["a", "b"]
|
||||||
|
---
|
||||||
|
-- layouts/taxonomy/tag.html --
|
||||||
|
Tag: {{ .Title }}|
|
||||||
|
-- content/tags/a/_index.md --
|
||||||
|
---
|
||||||
|
title: tag-a-title-override
|
||||||
|
---
|
||||||
|
`
|
||||||
|
|
||||||
|
b := Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/tags/a/index.html", "Tag: tag-a-title-override|")
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user