feat(i18n): a multilingual site ships a root 404 page in the default language #321
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!321
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/320"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #320
What
On a site whose languages sit in folders, the theme now writes a root
/404.html: a copy of the default language's whole 404 document. A host that answers a miss with the root/404.html(deckle-hosted's Caddyfile tries/<segment>/404.html, then/404.html; Netlify, GitHub Pages, nginx/Caddy) now serves the site's own page with status 404 for unprefixed misses like cloonar.com's/leistungen/, where it used to serve the host's generic page.How
baseof.html's shell moves intopartials/document/open.htmlandclose.html.baseof.htmlwraps them aroundblock "main", so the shell still has one owner.layouts/404.htmlno longer uses baseof. It renders its main markup, with itsnotfound_*strings, between the same two partials and outputs that document.hugo.IsMultilingualandhugo.Sites.Default, the existing owner of the default language), it also publishes the document withresources.FromString. It is a copy, not an alias, so there is no meta refresh and no 200.--minifydoes not minify a published resource, so the copy goes throughminify. The minified result is re-wrapped as404.html, becauseminifyrenames the file to*.min.htmlandresources.Copydoes not undo that.hugo --minifythe copy is byte-identical to/<default>/404.html.hugoit is that same document, minified.Docs
baseof.html, the document partials and404.html;baseof.htmlmention now names the partial it moved to.hugo.tomlscaffold comment and theinternal/langcmdpackage doc: one sentence each.redo-theme: step 1 font preloads, step 3 contract, andreferences/theme-contract.md.verify-site: the multilingual top-level listing.migrate-site: section 2 and step 4.remove-element: where the lightbox Store flag now lives.Verification
go build ./... && go vet ./... && go test -count=1 ./...pass with the pinned Hugo 0.167.0 on PATH; the theme tests ran, none skipped. The web vitest suite passes (3357 tests).internal/theme/notfound_test.go:--minify: the root copy is byte-identical tode/404.html, has the German strings, no refresh and no hreflang; the exact file list shows no intermediate or*.min.htmlfile is published;harness initsite:diff -ragainst a build withmain's theme is empty;harness lang add en:harness checkpasses, the build lists404.html de/404.html de/index.html de/leistungen/index.html en/404.html index.html,cmp 404.html de/404.htmlreports identical, and the h1 reads "Seite nicht gefunden";harness lang remove en: the output is identical to the one-language baseline.404.html.Not verified here: the hosted acceptance item, an unprefixed miss on a deckle-hosted preview or live site answering 404 with the site's page. It needs a deploy from this branch. I did confirm that the deckle-hosted snapshot's
deploy/Caddyfileuses thetry_files /{segment}/404.html /404.htmlorder the issue assumes.Note: the 404 layout's inline partial uses Hugo's
_partials/inline/naming, which needs Hugo 0.146 or later. The theme already depends onhugo.Sites.Default, andharness lang addrequires 0.167.🤖 Generated with Claude Code
[autoland] verdict: pass
PASS. Signal: CI aggregate success (ci / build-and-test, run 333: npm test, go vet, go test ./... with pinned Hugo 0.167.0, so the internal/theme tests incl. the new notfound_test.go and TestLightboxInProduction ran). Conventions: Conventional Commits title, Closes #320, diff matches the issue (theme 404 + document partials, README/AGENTS.md/ADR 0017/hugo.toml/langcmd docs, redo-theme/verify-site/migrate-site skills, remove-element pointer for the moved Store flag). Default language goes through hugo.Sites.Default, which already owns that rule. Independently checked with Hugo 0.167.0, main's theme vs this PR's on a de site: one-language output identical under diff -r, plain and --minify. On a multilingual site the only new file is the root 404.html, byte-identical to de/404.html under --minify and equal to the minified page on a plain build. deckle-hosted's deploy/Caddyfile tries /{segment}/404.html, then /404.html. Still open after deploy: the hosted acceptance item (an unprefixed miss answers 404 with the site's page).