Hard-coded capitalisation of the .Title property

Hugo appears to force the capitalisation of the .Title property when listing content belonging to particular terms in a given taxonomy. This might make sense as a template default, where it could be overridden by a custom template, but as things stand it is unnecessary and unhelpful to have this function hard-coded into the system.

For example, I have a custom template to display a list of content pages that have been associated with a particular term in a given taxonomy. The template includes the following line:

h1 Content with {{.Data.Singular}}: ‘{{.Title}}’

where {{.Title}} displays the tag, unfortunately capitalised.

It still seems odd to me that this capitalisation is hard-coded - perhaps I have missed something which would allow me to over-ride it?

1 Like

No, it’s hardcoded. You are one of two persons who have asked this question, so I wouldn’t call it very odd. A fix may be possible, but I’m not fan of another config setting for this. And turning it off would break stuff.

Thanks for the prompt reply!

I’m intrigued - what would be broken by removing this automatic formatting of metadata string values? Something to do with sorting?

People’s Hugo sites would be different, i.e. broken (or fixed; in the eye of the beholder …). I like the current behavior and I would be annoyed if it suddenly changed.

It’s true that changing the value of .Title would be breaking, but would it be possible to add another field somewhere that contained the original capitalisation (that is, the capitalisation used in the front matter)?

I am also running into this problem, because I am trying to use a taxonomy for authors. (e.g. a post might have authors = [ "John Smith", "Georges de Paris" ]). The latter name demonstrates the problem with title-case: it is not correct to render "de" as "De".

At the moment, the only way to retrieve (an) original capitalisation is to choose the first page associated with the term, loop over the values of the corresponding taxonomy (e.g. .Params.authors) and match it to the one you’re searching for using urlize.

I realise there’s a problem with ambiguity, as the capitalisation used might vary in the front-matters of different posts.

Regarding taxonomies, see this commit: 80a774d7. It’s included in 0.15 but apparently not documented. Opened a new issue:

@moorereason, excellent! Thanks very much for the pointer to that option.