Static blog generator that turns Markdown files into SEO-friendly, fully static HTML (no framework runtime). Output is written to dist/ and can be published directly (GitHub Pages supported out of the box)..
- Builds HTML pages from Markdown in
content/posts/ - Generates an index (optionally paginated) and one folder-per-post under
dist/<slug>/index.html(public URL/<slug>/; pagination: site root/,/page/N/) - Copies static assets from
src/assets/intodist/assets/ - Adds basic SEO metadata (canonical URL, OpenGraph, Twitter cards)
- Auto-embeds YouTube links and preserves inline HTML when rendering Markdown
- Node.js: the workflow uses Node 20; any recent Node 18+ should work
- npm:
package-lock.jsonis present, sonpm ciis supported
- Install:
npm ci(ornpm install) - Build:
npm run build- Writes output to
dist/ - Respects
BASE_PATH,SITE_URL, andCNAME(see below)
- Writes output to
- Dev server:
npm run dev- Runs a local server (default
http://127.0.0.1:4173/) - Rebuilds automatically on changes in
content/orsrc/ - Always uses
BASE_PATH=/for local convenience
- Runs a local server (default
- Clean:
npm run clean(removesdist/)
scripts/build.mjs: static site build (Markdown → HTML, templates, pagination, SEO metas)scripts/dev.mjs: rebuild-on-change + tiny HTTP server fordist/scripts/clean.mjs: deletesdist/scripts/lib/contentTransform.js: transforms content (YouTube URL → embed,<img>→ Markdown image)scripts/lib/postMeta.js: slug/title/excerpt + media detection for OG imagessrc/config.js: site title/tagline + pagination/excerpt settingssrc/templates/page.html: index template (list + pagination + “New Post” button)src/templates/post.html: post template (article + “Edit on GitHub” button)src/assets/*: CSS/JS/favicon copied todist/assets/dist/: generated output (publish this directory)
The builder supports “root sites” and “project pages” style hosting:
BASE_PATH: prefix used for links and asset URLs (always normalized to end with/)- Examples:
/or/my-repo/
- Examples:
SITE_URL: optional absolute site origin used to form canonical URLs and absolute OG image URLs- Example:
https://username.github.io
- Example:
When SITE_URL is not set, canonical/OG URLs remain relative (still valid for local previews).
Used by scripts/build.mjs:
BASE_PATH: URL prefix for links/assets (default:/)SITE_URL: absolute site origin for canonical URLs (default:src/config.jssite.url, or empty)CNAME: if set, writesdist/CNAMEwith this value
There’s a ready-to-use workflow at .github/workflows/deploy.yml:
- Builds on pushes to
main - Uses:
BASE_PATH=/<repo>/SITE_URL=https://<owner>.github.io
- Uploads
dist/as the Pages artifact and deploys it
- Index is written to both:
dist/index.html(convenience)dist/page/1/index.html(consistent pagination layout)
- A simple redirecting
dist/404.htmlis generated to send users back to the index (useful for project-pages routing)