Why is {{ .Type }} lower case and plural?

In list.html, I’m using this for category and tags archives:

<h3 class="archive-title">{{.Title}} {{ .Type }} Archive</h3>

to output the category or tag name and the type, either category or tag. But the Title output is plural and lowercase, i.e. tags or categories. How do I get the Title to be both singular and uppercase the first letter, i.e. Tag and Category ?

{{ .Type | singularize | title }}

singularize has a note pointing to .Data.Singular: https://gohugo.io/variables/taxonomy/#taxonomy-terms-page-variables, which probably fits your use case.

Thanks, I didn’t know where to look for something like singularize.

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