Static export
One command builds the whole site as HTML, CSS, JS and images, ready for any static host. The admin is used locally only.
Build
SITE_URL=https://your-domain.com pnpm build:localThe result is in dist/client/: the whole site as HTML, CSS, JS and images. dist/server/ isn’t needed for this way.
Upload
Upload dist/client/ to any static host: Cloudflare Pages (direct upload), Netlify (drag and drop), or ordinary hosting over FTP.
Warning
The site must sit at the root of its domain (https://your-domain.com/), not in a subfolder, because every link in it starts with /.
Change content
- Run
pnpm devand edit in the local admin. - Run the build command again.
- Upload
dist/client/again.
The admin in this build
The admin of a static export doesn’t work online (it calls a Tina server on your computer), and robots.txt already blocks /admin/. You can delete dist/client/admin/ before uploading.
Try the build first
Before uploading, you can run the build on your computer:
HOST=127.0.0.1 PORT=4064 node dist/server/entry.mjsthen open http://127.0.0.1:4064. An address that doesn’t exist (for example /khong-co/) must show the site’s 404 page.