Skip to content

Basics / 10

Deploy

Publish your theme on Netlify, Vercel, Cloudflare Pages, or any static host. Configs for the first two are included.

Browse the docs

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

  1. Set site in astro.config.mjs to your production domain.
  2. Run npm run build and npm run preview locally and click around.
  3. Pick a form provider. See Forms.
  4. 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/_headers has a Content-Security-Policy: frame-ancestors ... line listing baselayerthemes.com, it exists so our preview page can show the demo. Replace it with X-Frame-Options: DENY so 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-name to your own Cloudflare Pages project, change master to your branch name, and add your CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as repository secrets.

Netlify

netlify.toml is included, with security headers and long-term caching for built assets.

  1. Add new site → Import an existing project and choose your repository.
  2. Netlify reads the build command (npm run build) and publish folder (dist) from netlify.toml.
  3. Deploy, then add your domain under Domain management.

Vercel

vercel.json is included with the same headers.

  1. Add New → Project and import your repository.
  2. Vercel detects Astro. Leave the defaults.
  3. Deploy, then add your domain under Settings → Domains.

Cloudflare Pages

  1. Workers & Pages → Create → Pages → Connect to Git.
  2. Framework preset: Astro. Build command npm run build, output directory dist.
  3. Set the environment variable NODE_VERSION to 22 if 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.