Skip to content

Deploy Hugo

Hugo builds in a dedicated image with no dependency install step, so a Hugo deploy is usually the fastest on the platform. Connect the repository in the Quick Start and it deploys.

Two things decide whether it works first time: your baseURL and how your theme is vendored.

Setting Value
Build command hugo --minify
Output directory public
Install command none
Image ghcr.io/gohugoio/hugo:v0.168.0

The image is Hugo’s official one, in the extended edition, with Dart Sass included. Sass and SCSS transpile without extra setup, with either the default LibSass or transpiler: 'dartsass'. Go, Node with npm, and Git are in the image too. Every value above is editable per project, and the full defaults table covers the other frameworks.

Hugo writes absolute URLs into canonical tags, RSS feeds, sitemaps and most theme templates, using baseURL from your config. The default http://localhost:1313/ ships to production unnoticed, because the pages still build and the site still looks correct until someone follows a feed link.

hugo.toml
baseURL = 'https://example.com/'

Point it at your custom domain once you have one, otherwise at your .sites.deploybase.eu URL. Keep the trailing slash: Hugo concatenates rather than resolves, so omitting it produces https://example.comabout/.

If you need a different value per environment, override it in the build command instead of editing the config:

Terminal window
hugo --minify --baseURL https://example.com/

Builds clone one repository at one commit. Git submodules are not initialised, so a theme added as a submodule leaves themes/your-theme/ empty and the build fails with a missing layout.

Either vendor the theme into the repository:

Terminal window
git rm --cached themes/your-theme
rm -rf themes/your-theme/.git
git add themes/your-theme && git commit -m "vendor theme"

Or switch to a Hugo module, which the build resolves over the network like any other dependency:

[module]
[[module.imports]]
path = 'github.com/theme-author/your-theme'

Modules need go.mod and go.sum committed. Without go.sum the build fails on a checksum mismatch rather than fetching the theme.

Every site builds with Hugo 0.168.0. We move to new Hugo releases as they come out, so this version goes up over time. You cannot choose a version yet: setting HUGO_VERSION has no effect, because nothing in the image reads it. That variable is a Netlify convention, not a Hugo one.

Declare the oldest release your site works with, so a build on an older Hugo fails loudly rather than rendering wrong:

[module]
[module.hugoVersion]
extended = true
min = '0.168.0'

If your site needs a specific release, say so at support@deploybase.eu and tell us which one.

Error: module "your-theme" not found. The theme is a submodule that was never vendored. See above.

Every internal link points at localhost. baseURL was left at its default. See above.

The build succeeds but the site is empty. Your config sets publishDir to something other than public. Set the project’s output directory to the same path, or drop the override.

Pages are missing from the deploy but present locally. Content with draft: true, a future date, or an expiryDate in the past is excluded from a production build by design. Add --buildDrafts, --buildFuture or --buildExpired to the build command if you meant to publish them.

TOCSS: failed to transform. The standard Hugo image cannot compile Sass, but ours is the extended build, so this one points at something else: usually a @import path that resolves only on a case-insensitive filesystem. Linux is case-sensitive; macOS is not.

Live a8b7eb1d built