# Eleventy

Eleventy writes _site/ by default and needs no flags.

Eleventy builds to `_site/` unless you tell it otherwise.

```console title="eleventy"
$ npx @11ty/eleventy
[11ty] Writing _site/index.html from ./src/index.njk
[11ty] Wrote 64 files in 0.42 seconds
$ one9x pages release ./_site --site mysite --deploy
✓ v1 live
→ https://mysite.one9x.app/
```

**No `--spa`.** Eleventy writes a real HTML file per page.

## If you changed the output directory

```js
// eleventy.config.js
export default function (eleventyConfig) {
  return { dir: { input: 'src', output: 'dist' } };
}
```

Deploy whatever `dir.output` says — the flag is just a path.

## pathPrefix

`pathPrefix` exists for deploying under a subdirectory. On a One9x site you are
at the root of your own subdomain, so leave it at `/`. A `pathPrefix` left over
from a GitHub Pages project repo produces a site whose every internal link is
one level too deep.

## Custom 404

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

Eleventy's own dev server has a separate 404 setting; it does not affect the
build, and the deploy flag is what decides what visitors get.

## Start from a template

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

[`one9x/template-eleventy`](https://github.com/one9x/template-eleventy) is a minimal Eleventy 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: npx @11ty/eleventy
- uses: one9x/pages-deploy@v1
  with:
    site: mysite
    dir: _site
    error-pages: "404:/404.html"
    token: ${{ secrets.ONE9X_TOKEN }}
    deploy: ${{ github.ref == 'refs/heads/main' }}
```