Skip to content

Commit 7580505

Browse files
fezcodeclaude
andcommitted
build(ssg): add post-build crawler for content prerender
Vike's native prerender emitted per-route HTML shells but the React tree was empty in each (client-only Page, no SSR). Crawlers that don't run JS — Slack link previews, DuckDuckGo, Bing's older bot, archive.org — saw blank bodies despite correct head metadata. Add scripts/prerender-crawl.mjs: boots Vite preview in-process, drives Puppeteer through all 140 static routes in parallel, captures each rendered #react-root and inlines it into the corresponding HTML file. Refreshes 404.html from the crawled home as the SPA fallback. Skipped routes (slow/empty render within 10s) keep their empty shell and are not a build failure. One current skip: /sitemap. npm run build = vite build + shell 404 + crawler (~1–2 min) npm run build:fast = vite build + shell 404 only (for quick iter) Result: content pages now ship 50 KB – 750 KB of real rendered HTML per route instead of a 3.6 KB shell. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4ae4453 commit 7580505

4 files changed

Lines changed: 198 additions & 88 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"prestart": "npm run pregenerate",
4949
"start": "vite",
5050
"prebuild": "npm run pregenerate",
51-
"build": "vite build && node scripts/post-build.mjs",
51+
"build": "vite build && node scripts/post-build.mjs && node scripts/prerender-crawl.mjs",
52+
"build:fast": "vite build && node scripts/post-build.mjs",
5253
"preview": "vite preview",
5354
"test": "vitest",
5455
"lint": "eslint \"src/**/*.{js,jsx}\" \"scripts/**/*.{js,mjs}\" --fix",

public/rss.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<link>https://fezcode.com</link>
1010
</image>
1111
<generator>RSS for Node</generator>
12-
<lastBuildDate>Thu, 23 Apr 2026 06:39:17 GMT</lastBuildDate>
12+
<lastBuildDate>Thu, 23 Apr 2026 07:11:13 GMT</lastBuildDate>
1313
<atom:link href="https://fezcode.com/rss.xml" rel="self" type="application/rss+xml"/>
14-
<pubDate>Thu, 23 Apr 2026 06:39:17 GMT</pubDate>
14+
<pubDate>Thu, 23 Apr 2026 07:11:13 GMT</pubDate>
1515
<copyright><![CDATA[2026 Ahmed Samil Bulbul]]></copyright>
1616
<language><![CDATA[en]]></language>
1717
<managingEditor><![CDATA[samil.bulbul@gmail.com (Ahmed Samil Bulbul)]]></managingEditor>

0 commit comments

Comments
 (0)