Skip to content

Add styled prerendered 404 page#43

Merged
Marv51 merged 1 commit into
mainfrom
add-404-page
Jul 11, 2026
Merged

Add styled prerendered 404 page#43
Marv51 merged 1 commit into
mainfrom
add-404-page

Conversation

@Marv51

@Marv51 Marv51 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Serves a styled 404 for unknown URLs on GitHub Pages, instead of the default Pages error page.

How it works

  • A self-contained NotFound component (large Fraunces "404", short EN + DE message, "Back home" button), theme-aware for light/dark.
  • A top-level 404 route prerenders it to static HTML. The deploy workflow copies build/client/404/index.htmlbuild/client/404.html, the root-level file Pages serves for unknown URLs.
  • The root ErrorBoundary also renders NotFound on a 404 — this is the path that actually runs when Pages serves 404.html at an unknown URL and the app boots with no matching route. The Layout language check is hardened for the empty-match case since it's now on that path.

Verification

Built the production output, replicated the copy step, and served it without SPA rewriting to mimic Pages. Unknown URLs (top-level and nested) return HTTP 404 with the styled page. In a browser at a nested unknown URL, React boots into the error boundary with no console errors and no hydration warnings, in both light and dark mode.

🤖 Generated with Claude Code

GitHub Pages serves a root-level 404.html for unknown URLs. Add a
self-contained NotFound component, prerender it via a /404 route, and
copy the output to build/client/404.html in the deploy workflow.

The root ErrorBoundary also renders NotFound on a 404 — that's the path
that runs when Pages serves 404.html at an unknown URL and the app
boots with no matching route. Harden the Layout language check for the
empty-match case since it's now on that path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Marv51
Marv51 merged commit 34681ce into main Jul 11, 2026
2 checks passed
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