fix(template): show tag display names instead of their slugs - #1586
Closed
culfin wants to merge 1 commit into
Closed
fix(template): show tag display names instead of their slugs#1586culfin wants to merge 1 commit into
culfin wants to merge 1 commit into
Conversation
The server-rendered templates print the slug of a tag where the interface prints its display name. For Latin-script tags the difference is a matter of case; for everything else the slug is a transliteration, so a page about a tag named 眼镜 renders as "yan-jing". Search engines see nothing but these pages, and so does every reader before the interface takes over. Changed in question.html, question-detail.html, tag-detail.html (both the heading and the list) and tags.html. Only the text, never the href — links go on using the slug. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The server-rendered templates print a tag's slug where the React interface
prints its display name:
For Latin-script tags this is a matter of case —
binokularsehenagainstBinokularsehen. For everything else it is worse: Answer transliterates slugs(hence
mozillazg-go-unidecodeamong the dependencies), so a tag named 眼镜renders as
yan-jingon every server-rendered page.Two audiences are affected: search engines, which see nothing else, and readers,
until the interface takes over.
Changed in four templates —
question.html,question-detail.html,tag-detail.html(the heading and the list) andtags.html. Only the text;every
hrefgoes on using the slug.Note
display_nameisnot null defaultinentity.Tag, so a tag with an emptydisplay name would now render as an empty badge. The API requires the field when
a tag is created, so this should not occur — but if you would rather have a
fallback,
{{if .DisplayName}}…{{else}}{{.SlugName}}{{end}}is a one-linechange and I am happy to add it.
🤖 Generated with Claude Code