Deployment
Cook builds your site into the dist/ directory. That directory contains plain HTML, CSS, JS, and images -- everything a web server needs. No runtime, no server-side process.
Static hosting (any server)
Any HTTP server that can serve static files will work. Point it at dist/ and you are done.
npx cook build<p></p><h1>Upload or rsync the dist/ directory to your server</h1>
GitHub Pages
Build and deploy with a GitHub Actions workflow, then set Settings > Pages > Source to "GitHub Actions" so the workflow artifact is deployed directly.
name: Deployon: push: branches: [main]permissions: contents: read pages: write id-token: writejobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm - run: npm ci - run: npx cook build - uses: actions/upload-pages-artifact@v3 with: path: dist deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment uses: actions/deploy-pages@v4
A project site is served under the repository name (https://user.github.io/repo/), not the domain root. Set basePath: '/repo' so root-relative links and assets resolve; see Configuration. User sites (user.github.io) and custom domains are served at / and need no basePath.
Cloudflare Pages
Connect your repository in the Cloudflare dashboard and configure the build:
- Build command:
npx cook build - Build output directory:
dist
Cloudflare Pages will build on every push and deploy the dist/ directory to its global CDN.
Cloudflare Workers (content negotiation)
For advanced deployments, Cook ships an optional Cloudflare Worker that serves different formats from the same URL based on request headers. This enables SPA-style fragment loading, markdown endpoints, and JSON APIs from your static build output.
The worker performs content negotiation using these rules:
| Header | Value | Serves |
|---|---|---|
X-Requested-With | htmlstar | _fragment.html (content only) |
Accept | text/markdown | /md/ path (markdown source) |
Accept | application/json | /api/ path (JSON data) |
| Default | -- | index.html (full page) |
Deploy the worker with Wrangler. The wrangler.toml points at your dist/ directory for static assets:
name = "cook-site"main = "index.js"compatibility_date = "2024-12-01"<p></p><p>[assets]directory = "../dist"</p>
cd workernpx wrangler deploy
The worker adds Vary: Accept, X-Requested-With headers so CDN caches store each format separately.
Requests under /.well-known/ skip negotiation and return the built file untouched. The worker adds Access-Control-Allow-Origin: * to the three SocialSpec files (following.opml, about.md, contact.vcf). On Cloudflare Pages and Netlify, Cook also writes the matching _headers blocks; on other hosts, set those headers yourself.
Netlify
Add a netlify.toml to your project root:
[build] command = "npx cook build" publish = "dist"
Push to your connected repository and Netlify handles the rest.
What gets deployed
The dist/ directory is self-contained. Cook converts about.html to about/index.html for clean URLs, generates responsive image derivatives, and optionally produces fragments, markdown, JSON, and sitemap files -- all as static assets. No server-side code is required unless you opt into the Cloudflare Worker for content negotiation.