Skip to content

Cloudflare Pages Deployment

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. citeturn141248search1turn141248search5

Suggested deployment steps

  1. Push this repository to GitHub.
  2. In Cloudflare, create a new Pages project.
  3. Import the GitHub repository.
  4. Set:
  5. Production branch: main
  6. Build command: mkdocs build
  7. Build output directory: site
  8. Add environment variable PYTHON_VERSION=3.11.
  9. Deploy.

Cloudflare's MkDocs guide currently shows adding a PYTHON_VERSION environment variable, though the example value shown there is older. citeturn141248search1

Protect with Cloudflare Access

After deployment:

  1. Attach a custom domain such as docs.yourdomain.com to the Pages project.
  2. In Cloudflare Zero Trust, create a Self-hosted Access application for that hostname.
  3. Add an allow policy, such as:
  4. your personal email address
  5. your company email domain
  6. 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. citeturn141248search7turn141248search4

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.