Skip to content

fix(template): four defects in the server-rendered pages - #1592

Open
culfin wants to merge 1 commit into
apache:devfrom
Besser-Sehen-Landshut:fix/ssr-template-defects
Open

fix(template): four defects in the server-rendered pages#1592
culfin wants to merge 1 commit into
apache:devfrom
Besser-Sehen-Landshut:fix/ssr-template-defects

Conversation

@culfin

@culfin culfin commented Aug 24, 2026

Copy link
Copy Markdown

Four unrelated defects, all in ui/template/ — the pages the Go side renders
for search engines and for readers before the interface takes over. Each is a
line or two. They arrive together because they were all found the same way: by
putting those pages in front of visitors instead of only crawlers.

They are visible on this project's own instance

Fetched from meta.answer.dev/questions with a Googlebot user agent:

defect occurrences on that one page
avatar src prefixed with /users/ 10
alt="shuai" 10
width="24px" (invalid) 10
sort dropdown shipped opened 1
captured React id react-aria… 2

The first one is easy to check:

$ curl -sI "https://meta.answer.dev/users/https://www.gravatar.com/avatar/f296bdfb…"
HTTP/2 200
content-type: text/html;charset=utf-8

An HTML page where an image is expected.

The four

Broken avatars in the question list. src="{{$.baseURL}}/users/{{.Operator.Avatar}}"
prefixes a value that already holds the full reference — as the output above
shows, a complete https://… address ends up behind /users/. The four other
templates that display an avatar use the value directly. In the same tag:
alt="shuai" is placeholder text from a copied DOM, now the display name; and
width="24px" is invalid, because HTML dimension attributes take no unit, so
browsers discard it, fall back to the intrinsic size and every row of the list
grows.

The sort dropdown ships opened. class="show" on the group, the toggle and
the menu, aria-expanded="true", and the inline coordinates Popper had written
when that markup was captured. Without the interface the menu stands open over
the page, and assistive technology is told a collapsed control is expanded. The
same file carries id="react-aria8245013726-:r5:", referenced by an
aria-labelledby; replaced with a stable name.

The search placeholder is not translated. placeholder="Search" written
literally, though the key exists in all 45 language files as
ui.header.search.placeholder. Invisible on an English instance, one English
word in the middle of every other one.

Tags print their slug, not their display name. For Latin script that is a
matter of case; elsewhere the slug is a transliteration, so a tag named 眼镜
renders as yan-jing. Changed in four templates — text only, every href
keeps the slug. This is the one of the four that does not show on
meta.answer.dev, where every tag is a lowercase English word and the two are
identical.

Verified

All 14 templates parse before and after (html/template.ParseFiles with the
project's function map).

Replaces #1583, #1584, #1585 and #1586, which are the same four changes as
separate pull requests.

🤖 Generated with Claude Code

All four sit in `ui/template/`, the pages the Go side renders for search
engines and for readers before the interface takes over. They are unrelated to
each other and each is a line or two; they arrive together because they were
all found the same way — by putting those pages in front of visitors instead of
only crawlers.

**Broken avatars in the question list.** `src="{{$.baseURL}}/users/{{.Operator.
Avatar}}"` prefixes a value that already holds the full reference, so every
question renders a broken image. The four other templates that show an avatar
use it directly. Also in that tag: `alt="shuai"`, placeholder text from a
copied DOM, now the display name; and `width="24px"`, invalid because HTML
dimension attributes take no unit, so browsers fall back to the intrinsic size
and every row grows.

**The sort dropdown ships opened.** `class="show"` on the group, the toggle and
the menu, `aria-expanded="true"`, and the inline coordinates Popper had written
when that markup was captured. Without the interface the menu stands open over
the page, and assistive technology is told a collapsed control is expanded. The
same file carries a captured React id, `react-aria8245013726-:r5:`, referenced
by an `aria-labelledby`; replaced with a stable name.

**The search placeholder is not translated.** `placeholder="Search"` written
literally, though the key exists in all 45 language files as
`ui.header.search.placeholder`. One English word in an otherwise translated
page.

**Tags print their slug, not their display name.** For Latin script that is a
matter of case; elsewhere the slug is a transliteration, so a tag named 眼镜
renders as `yan-jing`. Changed in four templates — text only, every `href`
keeps the slug.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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