Documentation navigation
Anybuild documentation

Hugo

Build Hugo projects and serve their generated static output.

Detection

Hugo is detected from hugo.toml, hugo.json, hugo.yaml, hugo.yml, or a Hugo content layout with a compatible config file. An explicit Hugo build command is also recognized.

Output and version

The provider reads publishDir or destination from the Hugo config and otherwise uses public. The generated definition pins the detected Hugo version.

Configuration

Hugo inherits all configuration from the Static Files provider configuration. In addition, it supports the following provider-specific option.

VariablePurposeExample value
ANYBUILD_HUGO_VERSIONSelect the Hugo version used by the builder.0.153.2
Anybuild
load("//anybuild/tools:hugo.bzl", "hugo_build", "hugo_config")load("//anybuild/tools:staticfile.bzl", "staticfile_serve")
config = hugo_config(    schema = 1,    sws_version = "2.38.0",    hugo_version = "0.153.2",)
build = hugo_build(config)
staticfile_serve(config, build, name = "site")