How to retrieve the original value of a label in taxonomy?

My function is to calculate sha1 based on the tag value, and calculate different indexes based on sha1 to achieve random colors for each tag.
I have a tag called Hack The Box. In single, it displays Hack The Box normally. But in the taxonomy, when I sort and output, .Page.Title and .Page.LinkTitle are both Hack the Box, the first letter of the becomes lowercase, and .Name is hack the box. How can I get the original Hack The Box in the taxonomy?

{{ .Data.Term }}

https://gohugo.io/methods/page/data/#term

{{ range .Data.Terms.ByCount }}
 {{ $tag := .Data.Term }}

render: failed to render pages: render of “/tags” failed:
\layouts_default\taxonomy.html:34:36": execute of template failed at <.Data.Term>: can’t evaluate field Data in type page.OrderedTaxonomyEntry

Context.

  {{ range .Data.Terms.ByCount }}
    {{ .Page.Data.Term }}
  {{ end }}
1 Like

If you want to disable capitalization of list titles, put this in your site configuration:

capitalizeListTitles = false

Or you can change the capitalization rules for titles on automatic list pages:
https://gohugo.io/getting-started/configuration/#configure-title-case

Wow, that’s amazing, thank you so much!
This topic has been resolved.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.