Skip to content

fix(template): show tag display names instead of their slugs - #1586

Closed
culfin wants to merge 1 commit into
apache:mainfrom
Besser-Sehen-Landshut:fix/ssr-tag-display-name
Closed

fix(template): show tag display names instead of their slugs#1586
culfin wants to merge 1 commit into
apache:mainfrom
Besser-Sehen-Landshut:fix/ssr-tag-display-name

Conversation

@culfin

@culfin culfin commented Aug 24, 2026

Copy link
Copy Markdown

The server-rendered templates print a tag's slug where the React interface
prints its display name:

<a href="{{$.baseURL}}/tags/{{.SlugName}}" class="badge-tag …">
  <span class="">{{.SlugName}}</span>
</a>

For Latin-script tags this is a matter of case — binokularsehen against
Binokularsehen. For everything else it is worse: Answer transliterates slugs
(hence mozillazg-go-unidecode among the dependencies), so a tag named 眼镜
renders as yan-jing on 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) and tags.html. Only the text;
every href goes on using the slug.

Note

display_name is not null default in entity.Tag, so a tag with an empty
display 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-line
change and I am happy to add it.

🤖 Generated with Claude Code

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>
@culfin

culfin commented Aug 24, 2026

Copy link
Copy Markdown
Author

Folded into #1592 together with the other three defects in ui/template/ — one pull request is easier to review than four, and none of them is more than a line or two. Nothing is dropped, and the new one also targets dev as requested in #1572. Closing to keep the queue readable.

@culfin culfin closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant