summaryrefslogtreecommitdiffstats
path: root/hugolib/page__data.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/page__data.go')
-rw-r--r--hugolib/page__data.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/hugolib/page__data.go b/hugolib/page__data.go
index ad6ba126e..9712f1b4a 100644
--- a/hugolib/page__data.go
+++ b/hugolib/page__data.go
@@ -14,6 +14,7 @@
package hugolib
import (
+ "strings"
"sync"
"github.com/gohugoio/hugo/resources/kinds"
@@ -37,23 +38,18 @@ func (p *pageData) Data() any {
switch p.Kind() {
case kinds.KindTerm:
- b := p.treeRef.n
- name := b.viewInfo.name
- termKey := b.viewInfo.termKey
-
- taxonomy := p.s.Taxonomies()[name.plural].Get(termKey)
-
- p.data[name.singular] = taxonomy
+ path := p.Path()
+ name := p.s.pageMap.cfg.getTaxonomyConfig(path)
+ term := p.s.Taxonomies()[name.plural].Get(strings.TrimPrefix(path, name.pluralTreeKey))
+ p.data[name.singular] = term
p.data["Singular"] = name.singular
p.data["Plural"] = name.plural
- p.data["Term"] = b.viewInfo.term()
+ p.data["Term"] = p.Title()
case kinds.KindTaxonomy:
- b := p.treeRef.n
- name := b.viewInfo.name
-
- p.data["Singular"] = name.singular
- p.data["Plural"] = name.plural
- p.data["Terms"] = p.s.Taxonomies()[name.plural]
+ viewCfg := p.s.pageMap.cfg.getTaxonomyConfig(p.Path())
+ p.data["Singular"] = viewCfg.singular
+ p.data["Plural"] = viewCfg.plural
+ p.data["Terms"] = p.s.Taxonomies()[viewCfg.plural]
// keep the following just for legacy reasons
p.data["OrderedIndex"] = p.data["Terms"]
p.data["Index"] = p.data["Terms"]