website: prerender to static HTML for no-JS crawlers/agents - #31
Merged
Merged
Conversation
Renders the app to a string at build time via a separate SSR entry and inlines it into dist/index.html's #root, instead of shipping an empty div for client-side React to fill in. Lets crawlers and AI agents that don't execute JS see the actual page content. Chose this over migrating to Next.js since the site deploys to GitHub Pages (static hosting only), where Next's SSR/ISR advantages aren't available anyway. See DECISIONS.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 6, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dist/index.html's#rootcontains real markup instead of shipping empty for client React to fill in — fixes crawlers/AI agents that don't execute JS getting no content.actions/deploy-pages), so Next's actual SSR/ISR advantages need a Node/edge runtime that isn't available here — it would run inoutput: 'export'mode anyway, i.e. the same static HTML Vite already produces, for a single-page site with no router.website/src/entry-server.tsx(renderToString(<App/>)) is built with a separatevite.ssr.config.ts(only thereact()plugin —virtualConsoleVitePluginassumes an HTML build target and breaks otherwise), thenwebsite/scripts/prerender.mjsinlines the output intodist/index.htmland deletes the intermediatedist-ssr/.website/src/main.tsxnow hydrates when#rootalready has content (build/preview) and falls back to a normal client render when empty (vite dev, unprerendered).release-website.yml—pnpm run buildstill ends with static files inwebsite/dist.DECISIONS.md.Test plan
pnpm run buildinwebsite/succeeds;dist-ssr/is created then removed.curlof the builtdist/output (via a plain static file server, no JS execution) shows real page copy ("Drop it in", "Try it live", hero text) inside#root.pnpm run typecheckandpnpm run lint(oxlint) pass with no new warnings.pnpm run devlocally and confirm normal client-render still works (unprerendered#rootin dev is expected/by design).🤖 Generated with Claude Code