Personal site and blog built with React Router SSG, Vite, MDX, and Tailwind CSS.
- React Router v7 + Vite
- MDX with content-collections
- Tailwind CSS
- Waline comments (optional)
- Cloudflare R2 for static assets (optional)
pnpm install
pnpm devpnpm dev- start the Vite dev server (loads.env)pnpm build- build the site and run the R2 upload steppnpm serve- serve the production buildpnpm lint- run ESLint
- MDX pages live in
pages/; posts live inpages/posts/. - Frontmatter schema (all optional):
title,date,description,keywords,lang(zhoren),url,tags,comment. - If
titleis missing, it is inferred from the first#heading. - MDX images can use
public/paths; whenR2_PUBLIC_URLis set, absolute paths are prefixed with the CDN base.
Create a .env file if needed.
BASE=/
BUILD_REGION=
R2_ACCOUNT_ID=
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
R2_BUCKET_NAME=
R2_PUBLIC_URL=
WALINE_SERVER_URL=BASE- base path prefix for routes.R2_PUBLIC_URL- CDN base for assets and Vitebase.R2_*- required by the postbuild uploader to Cloudflare R2.WALINE_SERVER_URL- Waline server endpoint for comments.
pnpm buildoutputsbuild/and then runsscripts/upload-static-resource.tsto uploadbuild/clientto R2.- To build locally without uploading, run:
NPM_CONFIG_IGNORE_SCRIPTS=1 pnpm build