Show each page's own title in the browser tab (closes #117) #480

Merged
clawbot merged 1 commits from issue-117-page-titles into next 2026-10-03 01:30:03 +02:00
Collaborator

Every page's browser tab read "Webhooker" because parsePageTemplate parsed the page file before htmlheader.html. In html/template a later definition of a template name replaces an earlier one, except that an empty one never does, so the header's {{block "title"}} fallback replaced each page's {{define "title"}}. Page content was never affected only because base.html's {{block "content"}} is empty.

The page file is now parsed last. The set is created with template.New(pageFile), so it is still named after the page and the page's {{template "base" .}} is still what Execute runs; the comment that required the page file to be listed first is replaced to match.

TestEveryPageRendersItsOwnTitle renders every page template through the real template set and checks the tab title the page declares. A page that fails to render shows the error page's title instead, so it fails there too. TestTitleFallbackIsWebhooker checks the "Webhooker" fallback.

Judgement call: the fallback is checked on htmlheader.html alone, not through a page set, because every page declares a title and a test-only page would be needed otherwise.
Deviation: the issue's request for a cache-defeated script/cibuild run was dropped by the repo manager; it was not run.

Model: opus-5-5

Every page's browser tab read "Webhooker" because `parsePageTemplate` parsed the page file before `htmlheader.html`. In `html/template` a later definition of a template name replaces an earlier one, except that an empty one never does, so the header's `{{block "title"}}` fallback replaced each page's `{{define "title"}}`. Page content was never affected only because `base.html`'s `{{block "content"}}` is empty. The page file is now parsed last. The set is created with `template.New(pageFile)`, so it is still named after the page and the page's `{{template "base" .}}` is still what `Execute` runs; the comment that required the page file to be listed first is replaced to match. `TestEveryPageRendersItsOwnTitle` renders every page template through the real template set and checks the tab title the page declares. A page that fails to render shows the error page's title instead, so it fails there too. `TestTitleFallbackIsWebhooker` checks the "Webhooker" fallback. Judgement call: the fallback is checked on `htmlheader.html` alone, not through a page set, because every page declares a title and a test-only page would be needed otherwise. Deviation: the issue's request for a cache-defeated `script/cibuild` run was dropped by the repo manager; it was not run. Model: opus-5-5
clawbot added the needs-review label 2026-10-03 01:05:42 +02:00
clawbot self-assigned this 2026-10-03 01:05:42 +02:00
clawbot added 1 commit 2026-10-03 01:05:43 +02:00
parsePageTemplate parsed the page file before htmlheader.html. A later
definition of a template name replaces an earlier one (an empty one
never does), so htmlheader.html's {{block "title"}} replaced every
page's {{define "title"}} and every tab read "Webhooker". The page file
is now parsed last, into a set named after it, so it stays the entry
point.

A new test renders every page template and checks its title; the
"Webhooker" fallback is checked on htmlheader.html alone, since every
page declares a title.

Model: opus-5-5
Author
Collaborator

Review passed: each page now shows its own title in the browser tab, as #117 asks.

Model: opus-5-5

Review passed: each page now shows its own title in the browser tab, as https://git.eeqj.de/sneak/webhooker/issues/117 asks. Model: opus-5-5
clawbot merged commit 6395210474 into next 2026-10-03 01:30:03 +02:00
clawbot deleted branch issue-117-page-titles 2026-10-03 01:30:03 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#480