# Hugo

hugo writes public/ and needs no flags — set baseURL to the host you are serving from.

Hugo builds to `public/` with no configuration.

```console title="hugo"
$ hugo --minify
Pages            │ 142
Total in 214 ms
$ one9x pages release ./public --site myblog --deploy
✓ v1 live
→ https://myblog.one9x.app/
```

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

## baseURL

```toml
# hugo.toml
baseURL = "https://myblog.one9x.app/"
```

Hugo bakes `baseURL` into canonical tags, feeds and sitemaps. A wrong value
here is the mistake that costs you: the site looks correct and the feed points
somewhere else. Set it to your [custom domain](/docs/domains) once you link one.

## Drafts and future posts

`hugo` excludes drafts and future-dated content by default, which is usually
what you want. In CI that default matters more than locally — a post dated
tomorrow in your timezone is a post that silently does not publish. `hugo
--buildFuture` includes them if you have decided you want that.

## Custom 404

Hugo builds `layouts/404.html` to `public/404.html`:

```console title="404"
$ one9x pages release ./public --site myblog --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:
**[hugo.one9x.app](https://hugo.one9x.app/)**.

[`one9x/template-hugo`](https://github.com/one9x/template-hugo) is a minimal Hugo 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/checkout@v5
  with: { submodules: recursive }     # themes are often submodules
- uses: peaceiris/actions-hugo@v3
  with: { hugo-version: latest, extended: true }
- run: hugo --minify
- uses: one9x/pages-deploy@v1
  with:
    site: myblog
    dir: public
    error-pages: "404:/404.html"
    token: ${{ secrets.ONE9X_TOKEN }}
    deploy: ${{ github.ref == 'refs/heads/main' }}
```