Skip to content

feat: prerender every page with its own head tags, share images and structured data - #16

Merged
spin311 merged 10 commits into
mainfrom
feat/prerender-seo
Nov 26, 2026
Merged

spin311 merged 10 commits into
mainfrom
feat/prerender-seo

Conversation

@spin311

@spin311 spin311 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Summary

Every URL served the same empty index.html (an SPA). So:

  • Google, link-preview bots (LinkedIn, Slack, Facebook) and LLM crawlers (GPTBot, ClaudeBot, PerplexityBot) saw the same title and description on every page and no content;
  • og:image pointed at /assets/favicon.ico, which returns 404, so shared links had no picture;
  • "svit spindler" averaged position 11.6 in Search Console over 16 months, with no canonical links and no structured data.

Now every route is prerendered at build time to static HTML, with its own head tags and its content in the body. The client hydrates it.

Changes

  • Prerender: npm run build builds the client, builds src/entry-server.tsx for SSR, writes the sitemap, then runs scripts/prerender.mjs. That writes build/<route>/index.html for all 10 routes plus build/404.html. Routes live once in src/AppRoutes.tsx, shared by the browser and server entries.
  • Netlify: each route rewrites to its own file (force = true, status 200); the catch-all serves /404.html with status 404. [build] is now in netlify.toml, so the prerender step can't be skipped.
  • Hydration: hydrateRoot for the default visitor (English, light theme). Visitors with Slovenian or dark mode saved get a client render, with the route chunk preloaded first so nothing goes blank. An inline script sets the dark body class before first paint. Theme, language, useIsMobile (now useSyncExternalStore) and useFlipAnimation are safe to render on the server.
  • Head metadata from one source (src/seo/routes.ts + RouteMeta): title, description, canonical, 9 og:* and 5 twitter:* tags per route. The home title is "Svit Spindler, Full-Stack Software Engineer in Ljubljana". /uninstall and the 404 page are noindex.
  • Share images (1200×630): home, Free Game Claimer, Prolific. The other pages use the home image, and none shows Microsoft imagery. The template and generator are in scripts/og/.
  • JSON-LD: Person + WebSite on the home page; SoftwareApplication (no ratings) on the three extension pages.
  • LLM crawlers: prerendered content; robots.txt names GPTBot, OAI-SearchBot, ChatGPT-User, ClaudeBot, Claude-User, Claude-SearchBot, PerplexityBot, Perplexity-User, Google-Extended, Applebot-Extended and CCBot as allowed; llms.txt refreshed (role line, Nightwatch as Full Stack, FGC in 7 languages).
  • Sitemap: <lastmod> added, /uninstall dropped.
  • No layout shift: Font Awesome CSS is bundled instead of injected at runtime, and all CSS is inlined (cssCodeSplit: false, about 12 KB). CLS went from 0.415 (first try) to 0.
  • CI: check-netlify-routes and check-sitemap read AppRoutes.tsx and the SEO route table.

Merges cleanly with #14 and #15 in any order. The three merged together pass lint, tsc and checks, and build; the prerendered home page then contains #15's new copy.

How to test (deploy preview)

  1. curl -s <preview>/free-game-claimer | grep -E '<title>|og:image|ld\+json': the page's own title, an absolute share image and JSON-LD are in the raw HTML. /free-game-claimer answers 200 with no redirect, and /nope answers 404.
  2. Paste the preview's home URL into a LinkedIn post draft (don't post): the card shows the new title and image.
  3. Click through every page at desktop and phone width: no blank flash, no console errors. Language and dark-mode toggles work and survive a reload.
  4. Unchanged: page content and layout.

After merging: Search Console → URL Inspection → test the live URL for / and request indexing; Rich Results Test on / and /free-game-claimer.

@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rainbow-halva-839807 ready!

Name Link
🔨 Latest commit 98f6c1b
🔍 Latest deploy log https://app.netlify.com/projects/rainbow-halva-839807/deploys/6b080548e4e3681a109ac315
😎 Deploy Preview https://deploy-preview-16--rainbow-halva-839807.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@spin311

spin311 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Checked on this deploy preview (26 Nov, after 98f6c1b):

@spin311
spin311 merged commit 626db47 into main Nov 26, 2026
5 checks passed
@spin311
spin311 deleted the feat/prerender-seo branch November 26, 2026 16:36
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