Notes on a Zero-Friction Static Site Setup (Astro + Pagefind + GitHub Pages)
Architecture choices behind this rebuild: conditional KaTeX, language-scoped Pagefind search, and private-source to public-artifact publishing.
When reviving a personal blog, the biggest risk is not choosing the wrong framework—it is creating maintenance overhead that makes you stop publishing.
Key Engineering Decisions
- Zero external runtime CDNs: Fonts use a crisp system editorial stack and KaTeX stylesheets are vendored locally, avoiding the broken third-party CDN problem that hit the 2019 Hexo build.
- Opt-in math rendering: Only posts with
math: trueactivate inline/display LaTeX parsing (for example, or ), so shell snippets containing$HOMEor$1in legacy posts are never mangled. - Scoped search: Pagefind indexes the main English catalog (
EssaysandNotes) separately from the 2013–2019Archive, preventing 70+ historical Chinese posts from drowning out new English essays. - Private source, public output: Drafts and editorial workflows stay in a private source repository; only audited static build artifacts are published to the public Pages branch.
# Create a new draft essay
pnpm run new essay "your-post-slug"
# Build static site + Pagefind index and run privacy/route checks
pnpm run build && pnpm run verify