Skip to content

fix: illustrated 404 and 500 error pages - #183

Merged
Alexgodoroja merged 1 commit into
mainfrom
fix/404-500-error-pages
Jul 29, 2026
Merged

fix: illustrated 404 and 500 error pages#183
Alexgodoroja merged 1 commit into
mainfrom
fix/404-500-error-pages

Conversation

@Alexgodoroja

Copy link
Copy Markdown
Collaborator

Extracts the error-page work that was stranded on pilot-32 and lands it cleanly on main.

pilot-32 carried this alongside ~25k lines of unrelated perf/lighthouse artifacts and an astro-assets refactor. This branch takes only the 404/500 concern, rebuilt on current main.

What's here

  • The illustration. public/img/sad-doodle.png — both error pages are recentered around it. The art is white-on-transparent, so it's inverted under the light theme.
  • scripts/build-cf-error-pages.mjs — emits fully self-contained 404/500 HTML (inline CSS, base64 image, no external fetches) into dist/cloudflare-pages/ for Cloudflare's zone-level Custom Pages slot. Those are served when Pages itself is unreachable, so they can't depend on any asset the site serves. Wired into npm run build.
  • functions/500.ts — makes /500 return an actual HTTP 500. Every static CF Pages route answers 200, which makes the branded 500 useless to a Worker or monitor. It serves the generated body inline rather than proxying /500.html, which 308-redirects back into the same function and returns an empty body (browsers then offer the response as a 0-byte download).

Deliberately left out

  • The lighthouse/perf artifacts and MarketingLayout refactor from pilot-32. The pages here keep main's existing BaseHead/Nav/Footer scaffolding, so nothing else moves.
  • A package-lock.json diff from the original commit that only stripped "peer": true markers — unrelated churn.

Note for review

Two judgment calls worth a look:

  1. The original branch pointed "Report issue" at TeoSlayer/pilotprotocol, a personal fork. Retargeted to pilot-protocol/pilotprotocol, which is what the other 49 GitHub links on main use.
  2. The redesign drops the .nf-meta "Status / HTTP 404" footer block from both pages. That was the original branch's design intent (illustration-led, centered), but it does remove copy that's on main today — flagging in case you'd rather keep it.

Deploying the standalone pages to the CF Custom Pages slots is a manual dashboard step; dist/cloudflare-pages/README.md has the instructions.

Verification

npm ci, npm run check:plain, npm run build all pass locally — the same three steps CI runs. 372 pages built; generator wrote both standalone pages (~150KB each, well under CF's 1MB cap) with the image inlined. Generated functions/_500-body.ts is gitignored and stays untracked.

🤖 Generated with Claude Code

Extracts the error-page work from the pilot-32 branch, leaving behind the
unrelated perf/lighthouse artifacts and the astro-assets refactor that
branch also carried.

- Add the sad-doodle illustration and center both error pages around it.
  The art is white-on-transparent, so it is inverted under the light theme.
- Add scripts/build-cf-error-pages.mjs, which emits fully self-contained
  404/500 HTML (inline CSS, base64 image) into dist/cloudflare-pages/ for
  Cloudflare's zone-level Custom Pages slot. Those are served when Pages
  itself is unreachable, so they must not depend on site assets.
- Add functions/500.ts so /500 returns a real HTTP 500 instead of the 200
  that CF Pages gives every static route. It serves the generated body
  directly rather than proxying, which would recurse via clean-URL routing.
- Wire the generator into npm run build; gitignore its generated output.

The "Report issue" link is pointed at pilot-protocol/pilotprotocol, the org
repo used everywhere else on main, rather than the personal fork the
original branch referenced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview deployed to Cloudflare Pages

  • Commit deploy URL: https://f58e5288.pilotprotocol.pages.dev
  • Branch alias: https://fix/404-500-error-pages.pilotprotocol.pages.dev (may take ~30s to propagate)
  • Commit: f8f03ff8c51c1da58945309145eef8b44080c123

@Alexgodoroja
Alexgodoroja merged commit 4ae5a43 into main Jul 29, 2026
3 checks passed
@matthew-pilot
matthew-pilot deleted the fix/404-500-error-pages branch July 30, 2026 03:34
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