#43 Migrating from React to raw JS for a tiny SEO-friendly blog
I migrated my blog from a React/Vite app to a tiny build script that generates static HTML. wanted fewer moving parts, predictable output, and pages that are fast and indexable by default.
What problems I had (React)
- SEO bad: search engines can't render JS
- React was overkill: a blog is mostly text + images + embeds
The new approach (raw JS static generator)
Now the “app” is basically:
- A folder of markdown files:
content/posts/*.md - A build script:
scripts/build.mjs - A couple templates:
src/templates/page.htmlandsrc/templates/post.html - Minimal CSS + tiny optional JS for convenience buttons
At build time we:
- Read markdown
- Normalize content (e.g. convert
<img ...>to markdown images, embed YouTube links) - Extract metadata
- title
- excerpt (short description)
- preview image / YouTube thumbnail
- Render HTML for each post and for paginated index pages
No client-side router, no hydration, no “loading state”. Just pages.
SEO wins (the practical kind)
- The content is in HTML immediately. View-source shows the whole article.
- Faster first paint because we don’t ship a JS app just to display text.
- Stable metadata: each post page has its own
<title>and description.