A built theme is a folder of static files (dist/), so it runs anywhere that serves HTML. The usual route is to push your repository to GitHub and connect it to a host that builds on every push.
Before you deploy
- Set
siteinastro.config.mjsto your production domain. - Run
npm run buildandnpm run previewlocally and click around. - Pick a form provider. See Forms.
- Remove the demo-only settings below, if your theme has them.
Demo-only settings
Some themes still carry two settings from our live demo. Neither is needed for your site.
- Framing from baselayerthemes.com. If
public/_headershas aContent-Security-Policy: frame-ancestors ...line listing baselayerthemes.com, it exists so our preview page can show the demo. Replace it withX-Frame-Options: DENYso no other site can embed yours. - The demo’s deploy workflow. If there’s a
.github/workflows/deploy-pages.yml, it publishes our demo to Cloudflare Pages. Delete it, or change--project-nameto your own Cloudflare Pages project, changemasterto your branch name, and add yourCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDas repository secrets.
Netlify
netlify.toml is included, with security headers and long-term caching for built assets.
- Add new site → Import an existing project and choose your repository.
- Netlify reads the build command (
npm run build) and publish folder (dist) fromnetlify.toml. - Deploy, then add your domain under Domain management.
Vercel
vercel.json is included with the same headers.
- Add New → Project and import your repository.
- Vercel detects Astro. Leave the defaults.
- Deploy, then add your domain under Settings → Domains.
Cloudflare Pages
- Workers & Pages → Create → Pages → Connect to Git.
- Framework preset: Astro. Build command
npm run build, output directorydist. - Set the environment variable
NODE_VERSIONto22if the build complains about Node.
Headers and redirects come from public/_headers and public/_redirects, which Cloudflare Pages and Netlify both read.
Any other host
Run npm run build and upload the contents of dist/. Turn on “pretty URLs” or directory indexes if your host has the option, because every page is a folder with an index.html.
Redirects
Moving a page? Add a line to public/_redirects so old links keep working:
/old-page/ /new-page/ 301
Environment variables
Anything in .env locally must also be set in your host’s dashboard, for example INDEXNOW_KEY or analytics IDs.