Repository navigation
feat: prerender every page with its own head tags, share images and structured data - #16
Merged
Merged
Conversation
…hout layout shift
✅ Deploy Preview for rainbow-halva-839807 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ical on noindex pages
…ft prerendered text
Owner
Author
|
Checked on this deploy preview (26 Nov, after 98f6c1b):
|
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
Every URL served the same empty
index.html(an SPA). So:og:imagepointed at/assets/favicon.ico, which returns 404, so shared links had no picture;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
npm run buildbuilds the client, buildssrc/entry-server.tsxfor SSR, writes the sitemap, then runsscripts/prerender.mjs. That writesbuild/<route>/index.htmlfor all 10 routes plusbuild/404.html. Routes live once insrc/AppRoutes.tsx, shared by the browser and server entries.force = true, status 200); the catch-all serves/404.htmlwith status 404.[build]is now innetlify.toml, so the prerender step can't be skipped.hydrateRootfor 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(nowuseSyncExternalStore) anduseFlipAnimationare safe to render on the server.src/seo/routes.ts+RouteMeta): title, description, canonical, 9og:*and 5twitter:*tags per route. The home title is "Svit Spindler, Full-Stack Software Engineer in Ljubljana"./uninstalland the 404 page arenoindex.scripts/og/.Person+WebSiteon the home page;SoftwareApplication(no ratings) on the three extension pages.robots.txtnames GPTBot, OAI-SearchBot, ChatGPT-User, ClaudeBot, Claude-User, Claude-SearchBot, PerplexityBot, Perplexity-User, Google-Extended, Applebot-Extended and CCBot as allowed;llms.txtrefreshed (role line, Nightwatch as Full Stack, FGC in 7 languages).<lastmod>added,/uninstalldropped.cssCodeSplit: false, about 12 KB). CLS went from 0.415 (first try) to 0.check-netlify-routesandcheck-sitemapreadAppRoutes.tsxand 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)
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-claimeranswers 200 with no redirect, and/nopeanswers 404.After merging: Search Console → URL Inspection → test the live URL for
/and request indexing; Rich Results Test on/and/free-game-claimer.