Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert auto-capitalization of term titles #12115

Closed
jmooring opened this issue Feb 22, 2024 · 5 comments · Fixed by #12121
Closed

Revert auto-capitalization of term titles #12115

jmooring opened this issue Feb 22, 2024 · 5 comments · Fixed by #12121

Comments

@jmooring
Copy link
Member

This front matter:

tags = ['tag-a','tag-b']

Produces this taxonomy page:

image

And this term page:

image

Alternative 1

You can change your templates from this:

{{ range .Pages }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}

to this:

{{ range .Pages }}
  <h2><a href="{{ .RelPermalink }}">{{ .Data.Term }}</a></h2>
{{ end }}

...but that means you need one or two more templates to handle these page kinds.

Alternative 2

Do this in your site configuration...

titleCaseStyle = 'none'

...but that affects how the strings.Title function behaves as well.

Alternative 3

Create a term page for every term and set the title to whatever you want...

hugo new content tags/foo/_index.md

...but you have to do that for every term.

@bep
Copy link
Member

bep commented Feb 22, 2024

image

What's wrong with the above? And why is the alternative better?

@LorenDB
Copy link

LorenDB commented Feb 22, 2024

As the original reporter of this issue on the Hugo forum, I'll chime in here.

What's wrong with the above? And why is the alternative better?

I personally like having my tags rendered in lowercase, so I wrote them as lowercase in my YAML front matter. When I look at my tags page, now I see some tags like Ksp2. This is clearly incorrect, since KSP2 is an abbreviation for Kerbal Space Program 2. With this update, I'm forced to either uppercase tags like ksp2 or use a hacky workaround that may break other parts of my site.

I think auto-capitalizing things like this is also a bad idea in general. When I write text, I assume that it will be rendered without changes to its case, so if I write tags = ["foo", "bar", "ksp2"], I intend for them to be rendered in all lowercase.

@bep
Copy link
Member

bep commented Feb 22, 2024

OK, that's fine then (but I'm not doing the code work for this one :-))

@jmooring
Copy link
Member Author

jmooring commented Feb 22, 2024

I understand that we are also auto-capitalizing automatic section pages titles, but conceptually (from a content author's standpoint) section titles and terms are different things. There's also demand for disabling auto-capitalization of automatic section page titles:

#9793

We could do something like that instead, letting it apply to section, term, and taxonomy pages.


EDIT: The more I think about #9793, the more I like it. It's a good compromise. Casing of automatic titles will be consistent for section, taxonomy, and term.

@jmooring jmooring self-assigned this Feb 22, 2024
jmooring added a commit to jmooring/hugo that referenced this issue Feb 22, 2024
Whether to capitalize automatic page titles, applicable to section,
taxonomy, and term pages. Default is true.

Closes gohugoio#9793
Closes gohugoio#12115
@bep bep closed this as completed in 36bf3cb Feb 23, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants