Cloudflare Pages Setup Guide
Cloudflare Pages hosts your Quartz site with automatic deployments from GitHub.
Related: Quartz | Takopi | Secrets
Setup via Dashboard
- Go to Cloudflare Dashboard
- Select Pages → Create a project
- Connect your GitHub account
- Select your Quartz repository
- Configure build settings:
- Production branch:
v4(or your main branch) - Build command:
npx quartz build - Build output directory:
public
- Production branch:
- Add environment variable:
NODE_VERSION=22
- Click Save and Deploy
Custom Domain
- In Pages project → Custom domains
- Add your domain (e.g.,
yourdomain.com) - Follow DNS instructions to add CNAME record
CLI Deployment (Alternative)
Create API Token
- Go to API Tokens
- Create token with permissions:
- Account > Cloudflare Pages > Edit
- Account > Account Settings > Read
- User > User Details > Read
- Save token securely
Deploy via CLI
# Set token
export CLOUDFLARE_API_TOKEN="your-token-here"
# Build and deploy
cd /path/to/quartz
npx quartz build
npx wrangler pages deploy public --project-name=your-project-nameUseful CLI Commands
# List projects
npx wrangler pages project list
# List deployments
npx wrangler pages deployment list --project-name=your-project
# Create new project
npx wrangler pages project create your-project-nameAutomatic Deployments
With GitHub integration, Cloudflare automatically deploys on every push to your production branch.
Workflow:
- Make changes to content
- Run
npx quartz sync(commits and pushes) - Cloudflare detects push and rebuilds
- Site is live in ~1-2 minutes
Troubleshooting
Build fails with Node version error
- Add
NODE_VERSION=22in environment variables
404 on homepage
- Ensure
content/index.mdexists - Check build output includes
index.html
Changes not appearing
- Check deployment status in dashboard
- May take 1-2 minutes for propagation
- Try hard refresh (Ctrl+Shift+R)