Cloudflare Pages
Automatic Deployments
Section titled “Automatic Deployments”When Git integration is enabled, Cloudflare Pages builds pushes to the configured production branch and creates preview deployments for pull requests. Configure the build and branch settings in the Cloudflare dashboard.
Preview Deployments
Section titled “Preview Deployments”Pull requests get automatic preview deployments, so you can review changes before merging to master.
Manual Deployment
Section titled “Manual Deployment”pnpm build
# Deploy via wranglernpx wrangler pages deploy dist --branch=master
# Or via Cloudflare Dashboard# Project: astro-cloudflareDeployment Variables
Section titled “Deployment Variables”Set these in the Cloudflare Pages dashboard when your site needs them:
| Variable | Purpose |
|---|---|
SITE_URL |
Canonical URL of your site |
PUBLIC_GA_MEASUREMENT_ID |
Optional Google Analytics measurement ID |
PUBLIC_GTM_ID |
Optional Google Tag Manager container ID |
R2 Media (optional)
Section titled “R2 Media (optional)”The R2_MEDIA binding in wrangler.jsonc connects to a Cloudflare R2 bucket for
larger media assets. Configure the bucket and its public asset URL, then reference
the assets from your content. Remove the binding if you don’t need R2.
Branch Configuration
Section titled “Branch Configuration”master— Production builds- Feature branches — Preview builds triggered from pull requests