New site
This repository is the template: a new site starts as a copy of it and keeps everything described here.
Start a new site
- Create the repository from radimklaska/cfsite (Use this template on GitHub, or copy the files).
- Replace the names.
grep -rn cfsite --exclude-dir=node_modules .finds them all:wrangler.jsonc: the Workername(lowercase, hyphens) and the hostname inroutes;package.json:name;.github/workflows/deploy.yml:PROD_URL, the build step if the site is generated,SITE_DIRand the paths in Check the site;tests/visual.spec.mjs: the production URL and the page list;.github/workflows/link-checker.yml: the folder and the exclusions;README.md,CLAUDE.mdand of coursesite/.
npm install, and commit the updatedpackage-lock.json.- Check locally:
npx wrangler devserves the folder with the 404 page and the redirects, as production will. - Create the deploy token:
scripts/create-deploy-token.sh <repo>(see Hosting). - Make sure the hostname has no DNS record. Do not create one: the first deploy does (why).
- Push the first commit to
main. The deploy attaches the hostname, and Cloudflare creates the DNS record and the certificate. - Verify:
curl -sI https://<host>/answers 200 fromserver: cloudflare,http://redirects to https, a missing path returns the 404 page, and the analytics script is there:curl -s -H 'Accept: text/html' https://<host>/ | grep -c cloudflareinsights. - From now on, changes go through pull requests. Set up the Claude review secret
(Checks), and, if the branch should only take pull
requests, a ruleset on
main.
Docs in the repository
Every site's README.md and CLAUDE.md say where it is hosted,
how deploys and previews work, which secrets it needs, and the DNS caveat. CLAUDE.md is
what an AI assistant reads first, so the rules that matter (changes only through pull
requests, versions stay pinned, never create the DNS record by hand) go there.
Variants, not used here
- A generator (Jekyll, Hugo, …): build it in the deploy job and point
assets.directoryandSITE_DIRat its output. - Path filters on the deploy workflow, so only changes to the site deploy. Useful when a repository is mostly something else.