Page {{define "title"}} blocks never render; every browser tab reads "Webhooker" #117

Closed
opened 2026-08-11 14:32:36 +02:00 by clawbot · 3 comments
Collaborator

Found via a failing title assertion while doing the UI copy pass in #116.

parsePageTemplate parses the page file before htmlheader.html. That header contains {{block "title" .}}Webhooker{{end}}, which redefines the same template name and therefore wins. Every page's {{define "title"}} is dead: the browser tab reads "Webhooker" on every page regardless of what the page declares.

Consequence beyond cosmetics: any title copy is silently inert, so it cannot be relied on and a title assertion in one page's test would pass for the wrong reason.

Definition of done

  • Each page's {{define "title"}} renders in the browser tab, with htmlheader.html's block remaining the fallback for pages that declare none.
  • A rendering assertion per page template that the tab title matches that page, so the regression cannot return silently.

Implementation requirements

  • Expected fix is ordering: parse htmlheader.html ahead of the page file in parsePageTemplate's ParseFS arguments. Confirm that against html/template's actual redefinition semantics rather than assuming.
  • Branch from next, PR based on next, single commit, title ending (closes #N).
  • Touches internal/handlers/handlers.go and a test file. Do not take on unrelated copy changes.
  • Gate on make check plus script/cibuild with the Docker cache defeated.
Found via a failing title assertion while doing the UI copy pass in https://git.eeqj.de/sneak/webhooker/pulls/116. `parsePageTemplate` parses the page file *before* `htmlheader.html`. That header contains `{{block "title" .}}Webhooker{{end}}`, which redefines the same template name and therefore wins. Every page's `{{define "title"}}` is dead: the browser tab reads "Webhooker" on every page regardless of what the page declares. Consequence beyond cosmetics: any title copy is silently inert, so it cannot be relied on and a title assertion in one page's test would pass for the wrong reason. ## Definition of done - Each page's `{{define "title"}}` renders in the browser tab, with `htmlheader.html`'s block remaining the fallback for pages that declare none. - A rendering assertion per page template that the tab title matches that page, so the regression cannot return silently. ## Implementation requirements - Expected fix is ordering: parse `htmlheader.html` ahead of the page file in `parsePageTemplate`'s `ParseFS` arguments. Confirm that against `html/template`'s actual redefinition semantics rather than assuming. - Branch from `next`, PR based on `next`, single commit, title ending ` (closes #N)`. - Touches `internal/handlers/handlers.go` and a test file. Do not take on unrelated copy changes. - Gate on `make check` plus `script/cibuild` with the Docker cache defeated.
Author
Collaborator

Found again by the audit for #377, on current next: the browser tab reads "Webhooker" on the webhook list, the webhook page, the event log and the profile page.

Model: opus-5-5

Found again by the audit for https://git.eeqj.de/sneak/webhooker/issues/377, on current `next`: the browser tab reads "Webhooker" on the webhook list, the webhook page, the event log and the profile page. Model: opus-5-5
Author
Collaborator

Plan. Still true on next: every page's browser tab reads "Webhooker". Make each page's {{define "title"}} win over htmlheader.html's {{block "title"}} fallback, by the parse order in parsePageTemplate (confirm html/template's redefinition rule rather than assuming). Add one test that renders every page template and checks its <title> matches what the page declares, and that a page declaring none gets "Webhooker". No template or copy changes beyond what the fix needs.

Model: opus-5-5

Plan. Still true on `next`: every page's browser tab reads "Webhooker". Make each page's `{{define "title"}}` win over `htmlheader.html`'s `{{block "title"}}` fallback, by the parse order in `parsePageTemplate` (confirm `html/template`'s redefinition rule rather than assuming). Add one test that renders every page template and checks its `<title>` matches what the page declares, and that a page declaring none gets "Webhooker". No template or copy changes beyond what the fix needs. Model: opus-5-5
Author
Collaborator

Built in #480. parsePageTemplate now parses the page file last, so each page's {{define "title"}} replaces the "Webhooker" fallback in htmlheader.html: a later definition of a template name replaces an earlier one, except that an empty one never does. A new test renders every page template and checks its browser tab title.

Judgement call: the fallback is checked on htmlheader.html alone, since every page declares a title.
Deviation: the cache-defeated script/cibuild run asked for above was dropped by the repo manager and not run.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/webhooker/pulls/480. `parsePageTemplate` now parses the page file last, so each page's `{{define "title"}}` replaces the "Webhooker" fallback in `htmlheader.html`: a later definition of a template name replaces an earlier one, except that an empty one never does. A new test renders every page template and checks its browser tab title. Judgement call: the fallback is checked on `htmlheader.html` alone, since every page declares a title. Deviation: the cache-defeated `script/cibuild` run asked for above was dropped by the repo manager and not run. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#117