Personal site and blog built with React Router SSG, Vite, MDX, and Tailwind CSS. Hosted on Cloudflare Pages.
- React Router v7 + Vite (prerendered, no SSR)
- MDX with content-collections
- Tailwind CSS
- Waline comments (optional)
- Cloudflare Pages for hosting + CDN (everything, including images)
pnpm install
pnpm devpnpm dev- start the Vite dev server (loads.env)pnpm build- build the static site tobuild/client/pnpm serve- serve the production build locallypnpm deploy- publishbuild/client/to Cloudflare Pages via Wranglerpnpm lint- run ESLint
- MDX pages live in
pages/; posts live inpages/posts/<slug>/index.mdx. - Frontmatter schema (all optional):
title,date,description,keywords,lang(zhoren),url,tags,comment. - If
titleis missing, it is inferred from the first#heading. - Images are co-located with the post: drop them in the same folder and reference with relative paths, e.g.
. A remark plugin rewrites these into ESM imports so Vite hashes and bundles them. IDE markdown preview renders them inline.
Create a .env file if needed.
BASE=/
BUILD_REGION=
WALINE_SERVER_URL=
GA_ID=BASE- base path prefix for routes.WALINE_SERVER_URL- Waline server endpoint for comments.GA_ID- Google Analytics ID.
The site is hosted on Cloudflare Pages. Two ways to deploy:
- Connect this repo in the Cloudflare dashboard → Workers & Pages → Create → Pages → Connect to Git.
- Build command:
pnpm install --frozen-lockfile && pnpm build - Build output directory:
build/client - Environment variables: set
WALINE_SERVER_URL,GA_IDas needed (production scope). - Add the custom domain
suenyiyang.comunder the project's Custom domains tab.
Every push to main then ships automatically.
pnpm build
pnpm deployFirst run will prompt wrangler login.