On this page
Other Hosts
A Clay build is a folder of static files, publish/public. Any service or server that serves static files can host it. Three settings matter everywhere:
| Setting | Value |
|---|---|
| Build command | npx clay build --strict |
| Output folder | publish/public |
| Base URL | / at the root of a domain; otherwise baseURL in clay.yaml, or CLAY_BASE_URL in the build settings |
#Hosting services
In Site configuration → Build & deploy, or in a netlify.toml:
[build]
command = "npx clay build --strict"
publish = "publish/public"
[build.environment]
NODE_VERSION = "22"Netlify serves 404.html for unknown addresses on its own.
Create a project from your repository and set:
| Setting | Value |
|---|---|
| Framework preset | None |
| Build command | npx clay build --strict |
| Build output directory | publish/public |
| Environment variable | NODE_VERSION = 22 |
GitLab publishes the folder public of a job named pages. Move the build there in .gitlab-ci.yml:
pages:
image: node:22
variables:
GIT_DEPTH: 0 # full history for last-updated dates
script:
- npm ci
- npx clay build --strict
- mv publish/public public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCHProject sites on GitLab live under the project’s name, like on GitHub: set baseURL: "/my-project/".
A coding agent can set it up; name your host in place of Netlify:
Read https://clay-doc.github.io/clay-example-repo/publishing/other-hosts.md. Then deploy the Clay docs in this repository to Netlify: add the host's configuration, set baseURL in clay.yaml if the site is not at the root of its domain, and check with `npx clay build --strict`.
#Your own web server
Copy publish/public to the server and serve it as static files. Each page is a folder with an index.html, so the server should:
- serve
index.htmlfor folder addresses (/guides/setup/→/guides/setup/index.html), - answer unknown addresses with
404.htmland status 404.
With the site at the root of the domain:
server {
listen 80;
server_name docs.example.com;
root /var/www/docs;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
}FROM nginx:alpine
COPY publish/public /usr/share/nginx/htmldocs.example.com {
root * /var/www/docs
file_server
handle_errors {
rewrite * /404.html
file_server
}
}Tip
npx clay preview behaves like these hosts. If a page works there, it works on the server.