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
baseUrlset inquartz.config.ts(required for RSS and sitemap)
Steps
- In the Cloudflare dashboard, go to Workers & Pages → Create → Pages → Connect to Git.
- Authorize Cloudflare to access your GitHub account and select the Quartz repo.
- Set the build configuration:
- Build command:
npx quartz build - Output directory:
public - Production branch:
v4(or your default branch)
- Build command:
- Deploy. Cloudflare builds and publishes on every push to the production branch.
- 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
- quartz — full Quartz overview including all hosting options
- quartz-plugin-pipeline — how Quartz processes content before building