# Vercel

> Deploy via Vercel's git integration or the CLI, with preview URLs per PR.

Vercel won't recognise an htmlpress project or guess its build directory. A small `vercel.json` is all it takes.

## Build the site

```sh
htmlpress build
```

Output lands in `.htmlpress/build/`.

## Configure `vercel.json`

Drop this at your project root so Vercel uses the right command and serves the right directory:

```
{
  "framework": null,
  "buildCommand": "npx gethtmlpress build",
  "outputDirectory": ".htmlpress/build"
}
```

That's the whole config: Vercel handles install, build, and static serving from there, and answers unknown paths with the build's `404.html`. Vercel ignores `_headers`; set response headers in `vercel.json` instead.

## Deploy with the git integration

The recommended path: import your repo at [vercel.com/new](https://vercel.com/new). Vercel reads `vercel.json` and runs the same build you'd run locally. Every push to `main` ships to production; every other branch and PR gets a unique preview URL.

## Deploy with the CLI

For one-shot or scripted deploys:

```
vercel deploy --prod
```

The first run prompts for `vercel login` and links the directory to a Vercel project. Vercel runs the `buildCommand` itself.

## Deploy with GitHub Actions

Vercel's git integration is usually enough on its own, but you can gate deploys on CI tests:

```yaml
name: deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npx gethtmlpress build --json
      - run: npx vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}
        env:
          VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
```

The first `run` fails the job before deploying when a page doesn't build. You'll need `VERCEL_TOKEN`, `VERCEL_ORG_ID`, and `VERCEL_PROJECT_ID` as secrets (the latter two live in `.vercel/project.json` after the first local `vercel link`).

## Custom domain

In the project dashboard, **Settings → Domains → Add**. Vercel walks through DNS records and provisions a certificate automatically. Set the same domain as `site` in `htmlpress.yaml`.

## See also

- [Site Metadata](/customization/site-metadata/): `site` populates the sitemap URLs.
- [Deployment](/deployment/): back to the host index.
