Deploying the docs site (Cloudflare Pages)¶
The docs site (this site) is built with Zensical and hosted on Cloudflare Pages. Static HTML, free tier, instant cache invalidation.
Local preview¶
Opens a hot-reloading dev server at http://localhost:8000/. Save any markdown file → page reloads. Change zensical.toml → restart.
Local build¶
Produces a static site under docs-site/site/. Open docs-site/site/index.html in your browser to verify.
First-time Cloudflare Pages setup¶
Done once per project; you can skip this section if the project already has a Pages site.
- Sign in to the Cloudflare dashboard.
- Workers & Pages → Create application → Pages → Connect to Git.
- Pick the GitHub repo (you'll authorise the Cloudflare GitHub app the first time).
- Configure build:
- Production branch:
main - Build command:
pip install zensical && cd docs-site && zensical build - Build output directory:
docs-site/site - Root directory (advanced): leave as the repo root.
- Environment variables (if needed):
PYTHON_VERSION = 3.12(Cloudflare's default Python is older; pin if you hit issues).- Save and Deploy.
The first build runs immediately. Subsequent deploys happen automatically on every push to main. Preview deploys happen on every PR — Cloudflare leaves a comment on the PR with the preview URL.
Custom domain¶
If you've configured docs.lifefile.app:
- Pages site → Custom domains → Set up a custom domain.
- Enter
docs.lifefile.app. - Cloudflare adds the CNAME for you (because the domain is on Cloudflare DNS already). If it isn't, follow the on-screen DNS instructions.
Workflow¶
The convenient cycle:
- Edit a markdown file in
docs-site/docs/. uvx zensical serveto preview.- Commit + push to a feature branch.
- Open a PR → Cloudflare leaves a preview-deploy comment within ~30 seconds.
- Merge → production updates within ~30 seconds.
When the build breaks¶
- 404 on a nav link — usually a typo in
zensical.toml'snavtable. Compare against the directory tree. pymdownx.somethingnot found — thepip install zensicalstep is incomplete; pin the Zensical version in the build command if you hit version drift.- Missing image / asset — paths in markdown are relative to the markdown file's location. Move or fix the path.
Reverting¶
Cloudflare keeps every deploy. Pages site → Deployments → Rollback restores any previous build with one click.