]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Don't use the same value in .Data.Term.Title as in .Title
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 17 Feb 2024 11:00:40 +0000 (12:00 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 17 Feb 2024 11:34:50 +0000 (12:34 +0100)
Fixes #12041

hugolib/content_map_test.go
hugolib/page__data.go
hugolib/taxonomy_test.go

index c666e2a45f1034557698b2741ab86bad9264d441..e043d9363852ba16b4dc7aacec5f19f98bca8900 100644 (file)
@@ -160,7 +160,7 @@ Draft5: {{ if (.Site.GetPage "blog/draftsection/sub/page") }}FOUND{{ end }}|
         Sections: /blog/|/docs/|/overlap/|/overlap2/|:END
                Categories: /categories/funny/; Funny; 12|/categories/sad/; Sad; 2|:END
         Category Terms:  taxonomy: /categories/funny/; Funny; 12|/categories/sad/; Sad; 2|:END
-               Category Funny:  term; Funny: /blog/subsection/page4/;|/blog/page3/;|/blog/subsection/;|/blog/page2/;|/blog/page1/;|/blog/subsection/page5/;|/docs/page6/;|/blog/bundle/;|/blog/draftsection/page/;|/blog/draftsection/sub/;|/blog/draftsection/sub/page/;|/overlap2/;|:END
+               Category Funny:  term; funny: /blog/subsection/page4/;|/blog/page3/;|/blog/subsection/;|/blog/page2/;|/blog/page1/;|/blog/subsection/page5/;|/docs/page6/;|/blog/bundle/;|/blog/draftsection/page/;|/blog/draftsection/sub/;|/blog/draftsection/sub/page/;|/overlap2/;|:END
                Pag Num Pages: 9
         Pag Blog Num Pages: 4
         Blog Num RegularPages: 4
index 9712f1b4a250c99644a6d2cd5512ae5ec5bd72d8..256d8a97f0a4e1fc0bb0bf52b99cf4b1a39b2612 100644 (file)
@@ -44,7 +44,7 @@ func (p *pageData) Data() any {
                        p.data[name.singular] = term
                        p.data["Singular"] = name.singular
                        p.data["Plural"] = name.plural
-                       p.data["Term"] = p.Title()
+                       p.data["Term"] = p.m.term
                case kinds.KindTaxonomy:
                        viewCfg := p.s.pageMap.cfg.getTaxonomyConfig(p.Path())
                        p.data["Singular"] = viewCfg.singular
index ffcb8fb15c7c8d79b97cd125af20e0bc69813a26..17e1b6cd4063ed14df84fd4c185433be25a66a04 100644 (file)
@@ -815,3 +815,23 @@ Terms: {{ range site.Taxonomies.tags }}{{ .Page.Title }}: {{ .Count }}|{{ end }}
 
        b.AssertFileContent("public/index.html", "Terms: A: 1|B: 1|C: 1|Hello World!: 1|$")
 }
+
+func TestTaxonomiesTermTitleAndTerm(t *testing.T) {
+       files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+[taxonomies]
+tag = "tags"
+-- content/_index.md --
+---
+title: "Home"
+tags: ["hellO world"]
+---
+-- layouts/_default/term.html --
+{{ .Title }}|{{ .Kind }}|{{ .Data.Singular }}|{{ .Data.Plural }}|{{ .Page.Data.Term }}|
+`
+
+       b := Test(t, files)
+
+       b.AssertFileContent("public/tags/hello-world/index.html", "HellO World|term|tag|tags|hellO world|")
+}