# Astro

Astro's default static output builds to dist/ and needs no flags — this site is one.

Astro's default output is static, so there is nothing to configure. `npm run
build` writes `dist/` and you deploy it.

```console title="astro"
$ npm run build
building client (vite)
▶ dist/ 24 page(s) built in 1.83s
$ one9x pages release ./dist --site mysite --deploy
✓ v1 live
→ https://mysite.one9x.app/
```

**No `--spa`.** Astro writes a real HTML file per route.

> This documentation site is an Astro build deployed to Pages on every push —
> the same command, the same action, the same preview URLs.

## Set `site` for correct absolute URLs

```js
// astro.config.mjs
export default defineConfig({
  site: 'https://mysite.one9x.app',
});
```

Astro needs `site` to build canonical URLs, and it is what `@astrojs/sitemap`
uses. Set it to your custom domain if you have [linked one](/docs/domains) —
sitemaps with the wrong hostname are the one mistake here that search engines
act on.

## If you switched on an adapter

`output: 'server'` or a deployment adapter produces a build that needs a
runtime, not a folder of files. Remove the adapter and go back to the default
static output.

`output: 'hybrid'`/per-route `prerender` is fine for the prerendered routes and
not for the rest — if any route is server-rendered, the build as a whole needs a
server.

## Custom 404

Astro builds `src/pages/404.astro` to `dist/404.html`:

```console title="404"
$ one9x pages release ./dist --site mysite --deploy --error 404:/404.html
✓ v2 live · custom 404
```

## Start from a template

Live, and deployed by the workflow in that repo on every push:
**[astro.one9x.app](https://astro.one9x.app/)**.

[`one9x/template-astro`](https://github.com/one9x/template-astro) is a minimal Astro starter
with this deploy already wired up. Press **Use this template** on GitHub to get
your own copy, or read it as a reference for a project you already have.

Set two things in the new repo under **Settings → Secrets and variables →
Actions** and it deploys on every push:

| | Name | Value |
| --- | --- | --- |
| Variable | `ONE9X_SITE` | the site to deploy to |
| Secret | `ONE9X_TOKEN` | `one9x tokens create "github actions"` |

Until `ONE9X_SITE` is set the workflow is skipped rather than failed — a fresh
copy should not open with a red X.

## Deploying on every push

```yaml
- uses: actions/setup-node@v5
  with: { node-version: 22, cache: npm }
- run: npm ci
- run: npm run build
- uses: one9x/pages-deploy@v1
  with:
    site: mysite
    dir: dist
    error-pages: "404:/404.html"
    token: ${{ secrets.ONE9X_TOKEN }}
    deploy: ${{ github.ref == 'refs/heads/main' }}
```