On this page
Publishing
A Clay build is a folder of static files: there is no server to run, and any host that serves files can serve a Clay site.
CommandsEvery clay command and option, from the live preview to building, previewing, searching, editing and saving versions.Build ChecksThe problems clay build reports, how --strict turns them into errors, and what to do when a build fails.GitHub PagesPublish a Clay site on GitHub Pages with a workflow that checks and deploys the docs on every push.Other HostsDeploy a Clay site to Netlify, Cloudflare Pages, GitLab Pages or your own web server.
#From your docs to the web
- Preview while you write with
npx clay dev. - Build and check with
npx clay build --strict. Broken links and typos in the settings stop the build. - Look at the result with
npx clay preview, the way a web host serves it. - Publish
publish/public, best by a workflow on every push, see GitHub Pages or other hosts.
#Where to host
| Host | Cost | Set up in |
|---|---|---|
| GitHub Pages | Free for public repositories | A workflow file, see the guide |
| Netlify, Cloudflare Pages | Free plans | The host’s build settings |
| GitLab Pages | Free | .gitlab-ci.yml |
| Your own server | Your server | nginx, Caddy or Docker |
#Before you go live
Does the site live under a path?
A site at https://my-org.github.io/my-project/ needs baseURL: "/my-project/" in clay.yaml, or its styles and links break. Check with npx clay preview, which serves the site under its baseURL.
Do I want links and dates for search engines?
Set siteURL to the site’s origin, like https://my-org.github.io: pages then get canonical links, and the build writes a sitemap. See SEO.
Does CI fetch the full history?
Clay takes the last-updated date of each page from git. Most CI systems clone only the last commit; check out the full history to get the dates, see page details.
Tip
Run npx clay build --strict locally before you push. It takes a few seconds and catches the same problems CI would.