# Build and Deploy

Validate Dahlia, build static output, and configure a static host.

import { Callout, Steps } from '@prosefly/astro-components';

Dahlia produces a static Astro site. A deployment needs a build command, the
`dist/` output directory, and the correct public site URL.

## Validate a production build

<Steps>

1. **Run project checks.**

   ```sh
   pnpm check
   ```

2. **Build the site.**

   ```sh
   pnpm build
   ```

3. **Preview the generated output.**

   ```sh
   pnpm preview
   ```

   Open several docs pages, search for a page title, switch language when i18n
   is enabled, and verify that the previous and next links are correct.

</Steps>

<Callout type="warning" title="Builds may need network access">
  Iconify icons and remote embed metadata can be resolved during the build.
  Make sure the CI environment can reach those providers, or configure an
  internal Iconify endpoint and use explicit embed metadata.
</Callout>

## Host settings

Use these settings on Vercel, Netlify, Cloudflare Pages, or another static host:

| Setting | Value |
| --- | --- |
| Install command | `pnpm install --frozen-lockfile` |
| Build command | `pnpm build` |
| Publish directory | `dist` |

Set Astro's `site` option to the production origin so canonical URLs, metadata,
and generated links use the final domain:

```ts title="astro.config.ts"
import { defineConfig } from 'astro/config';
import dahlia from '@prosefly/astro-theme-dahlia';

export default defineConfig({
  site: 'https://docs.example.com',
  integrations: [dahlia()],
});
```

If the whole site is hosted below a path such as
`https://example.com/product/`, also set Astro's `base`. `docsBase` is different:
it places documentation below a route inside the Astro site, such as `/docs`.

## Verify after deployment

- Open the docs index and one nested page directly, not only through client
  navigation.
- Confirm the active locale's `search.json` URL returns `200`.
- Open a generated `.md` page when `view-markdown` is enabled.
- Check source and edit links against the configured repository branch.
- Confirm the host serves the generated `404.html` page.
