Cloudflare Pages Deployment¶
Recommended Pages settings¶
For MkDocs, Cloudflare's framework guidance uses:
- Build command:
mkdocs build - Build output directory:
site
Cloudflare's general build configuration reference also lists MkDocs with the same output directory. citeturn141248search1turn141248search5
Suggested deployment steps¶
- Push this repository to GitHub.
- In Cloudflare, create a new Pages project.
- Import the GitHub repository.
- Set:
- Production branch:
main - Build command:
mkdocs build - Build output directory:
site - Add environment variable
PYTHON_VERSION=3.11. - Deploy.
Cloudflare's MkDocs guide currently shows adding a PYTHON_VERSION environment variable, though the example value shown there is older. citeturn141248search1
Protect with Cloudflare Access¶
After deployment:
- Attach a custom domain such as
docs.yourdomain.comto the Pages project. - In Cloudflare Zero Trust, create a Self-hosted Access application for that hostname.
- Add an allow policy, such as:
- your personal email address
- your company email domain
- selected team members only
Cloudflare documents protecting Pages previews with Access and also provides an Access plugin for Pages Functions-based validation, which confirms Access is supported around Pages-hosted content. citeturn141248search7turn141248search4
Notes¶
- Access policy configuration is done in Cloudflare, not in this repository.
- This repository is ready for Pages deployment as a static site.
- You can protect production and preview deployments separately.