Packages generic-documentation-v1 as documentation-docusaurus: Diataxis quadrants, structure and voice rules, and four references for patterns, writing, config, and deployment. Content preserved from the source; renames the skill, strengthens the description for triggering, and converts the reference list into a routing table stating when to load each file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3.9 KiB
3.9 KiB
Deployment
Getting your docs live. Pick the platform that fits your workflow.
Quick Decision
| Platform | Best For | Effort |
|---|---|---|
| Vercel | Teams already using Vercel | Lowest |
| Netlify | Need redirects, forms, functions | Low |
| GitHub Pages | Open source, simple hosting | Low |
| Cloudflare Pages | Global performance, free tier | Low |
My recommendation: Vercel or Netlify for most projects. GitHub Pages if you want everything in one repo.
Vercel
Setup
- Push to GitHub
- Import at vercel.com
- Done—it auto-detects Docusaurus
Config (vercel.json, usually not needed)
{
"buildCommand": "npm run build",
"outputDirectory": "build"
}
Vercel handles this automatically. Only add if you need overrides.
Netlify
Setup
- Push to GitHub
- Connect at app.netlify.com
- Build command:
npm run build - Publish directory:
build
Config (netlify.toml)
[build]
command = "npm run build"
publish = "build"
[[redirects]]
from = "/old-path"
to = "/new-path"
status = 301
Opinion: Netlify's redirect handling is cleaner than most.
GitHub Pages
Config
// docusaurus.config.ts
const config = {
url: 'https://username.github.io',
baseUrl: '/repo-name/', // or '/' for username.github.io
organizationName: 'username',
projectName: 'repo-name',
trailingSlash: false,
};
GitHub Actions (recommended)
.github/workflows/deploy.yml:
name: Deploy
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: build
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
Enable Pages in repo settings → Pages → Source: GitHub Actions.
Cloudflare Pages
Setup
- Connect repo at pages.cloudflare.com
- Framework: None (not auto-detected well)
- Build command:
npm run build - Output directory:
build
Why Cloudflare
- Fastest global CDN
- Generous free tier
- Web analytics included
Pre-Deployment Checklist
Before pushing:
# 1. Build locally first
npm run build
# 2. Test the build
npm run serve
# 3. Check for broken links (build will fail if onBrokenLinks: 'throw')
# 4. Verify all images load
# 5. Test search works (if Algolia configured)
Custom Domain
All platforms support custom domains. General steps:
- Add domain in platform settings
- Update DNS:
Arecord to platform IP, orCNAMEto platform URL
- Wait for SSL certificate (automatic, usually minutes)
- Update
urlin docusaurus.config.ts
DNS propagation: Can take up to 48 hours. Usually much faster.
Environment-Specific Builds
For staging vs production:
const isProd = process.env.NODE_ENV === 'production';
const config = {
url: isProd
? 'https://docs.example.com'
: 'https://staging-docs.example.com',
};
Or use platform environment variables.
Common Issues
Build Fails Locally But Worked Before
rm -rf node_modules .docusaurus
npm ci
npm run build
Build Works Locally, Fails in CI
- Check Node.js version matches
- Check for case-sensitive filename issues (Linux is case-sensitive, macOS isn't)
- Check for absolute paths that only exist on your machine
"Page Not Found" After Deploy
- Check
baseUrlmatches your hosting path - Check
trailingSlashis consistent - Clear CDN cache if platform supports it