Step 9: Custom domain
Now you'll serve the site on your own domain.
Before you start
- Step 8 finished
- A domain that uses Cloudflare DNS
Do it
Type each command on its own and wait for it to finish before the next one.
Add your domain to wrangler.jsonc:
jsonc
"routes": [
{ "pattern": "example.com", "custom_domain": true },
{ "pattern": "www.example.com", "custom_domain": true }
]In site/.vitepress/config.ts, set your real URL:
ts
const siteUrl = 'https://example.com';Commit and push. Cloudflare deploys and sets up HTTPS.
bash
git commit -am "Custom domain"Expected output
text
[main 5d6e7f8] Custom domainbash
git pushExpected output
text
main -> mainOn Vercel instead: open your project → Settings → Domains, add example.com, and follow the DNS record it shows.
If you see an error:
domain already in usemeans another Worker or DNS record owns it. Remove that record in Cloudflare DNS, then push again.
Result
Your domain serves the site over HTTPS. Canonical links point to it.
Checkpoint
Next step
You're done. See what you built. Optional: go mobile with Expo.