Cloudflare Pages
Deploy your Hwaro site to Cloudflare Pages for fast global delivery.
Quick Start
Generate Config
hwaro tool platform cloudflare
This creates a wrangler.toml with project settings and site bucket configuration.
Deploy via Dashboard
- Go to Cloudflare Dashboard > Workers & Pages
- Click Create application > Pages > Connect to Git
- Select your repository
- Set build configuration:
- Build command:
hwaro build - Build output directory:
public
- Build command:
- Click Save and Deploy
Deploy via Wrangler CLI
# Install Wrangler
npm install -g wrangler
# Build the site
hwaro build
# Deploy
wrangler pages deploy public --project-name my-site
Manual Configuration
If you prefer to configure manually, set these in the Cloudflare Pages dashboard:
| Setting | Value |
|---|---|
| Build command | hwaro build |
| Build output directory | public |
Or create wrangler.toml:
name = "my-site"
compatibility_date = "2024-01-01" # Use current date when deploying
[site]
bucket = "./public"
Redirects
Cloudflare Pages uses a _redirects file in the output directory. Create static/_redirects with redirect rules for your page aliases:
/old-url/ /posts/new-post/ 301
/legacy/post/ /posts/new-post/ 301
Aliases are defined in page frontmatter:
---
title: New Post
aliases:
- /old-url/
- /legacy/post/
---
When using hwaro tool platform cloudflare, the generated wrangler.toml includes comments listing these redirects so you can copy them into static/_redirects.
Custom Domain
- Go to Workers & Pages > your project > Custom domains
- Click Set up a custom domain
- Follow DNS configuration instructions
- Update
base_urlinconfig.toml:
base_url = "https://www.yourdomain.com"
Preview Deployments
Cloudflare Pages automatically creates preview deployments for every branch push. Preview URLs follow the pattern: <branch>.<project>.pages.dev.
See Also
- Platform Config Generator — Detailed generator options
- CLI Reference — All tool commands
- Other platforms: Netlify | Vercel | GitHub Pages