Deploy Quartz to Cloudflare Pages

Connect a Quartz repository to Cloudflare Pages for automatic deploys on every push.

Prerequisites

  • Quartz repo pushed to GitHub (or GitLab)
  • Cloudflare account
  • baseUrl set in quartz.config.ts (required for RSS and sitemap)

Steps

  1. In the Cloudflare dashboard, go to Workers & Pages → Create → Pages → Connect to Git.
  2. Authorize Cloudflare to access your GitHub account and select the Quartz repo.
  3. Set the build configuration:
    • Build command: npx quartz build
    • Output directory: public
    • Production branch: v4 (or your default branch)
  4. Deploy. Cloudflare builds and publishes on every push to the production branch.
  5. Optionally add a custom domain under Custom domains in the Pages project settings.

Gotcha: Shallow Clone and Git Timestamps

Cloudflare Pages performs a shallow clone by default. If you use Quartz’s defaultDateType: "modified" (or any git-timestamp-based feature), dates will be wrong or missing.

Fix: prefix the build command with the unshallow step:

git fetch --unshallow && npx quartz build

See Also