Configure Modules
Module Config: Top level
config.
module:
noProxy: none
noVendor: ""
private: '*.*'
proxy: direct
replacements: ""
[module]
noProxy = "none"
noVendor = ""
private = "*.*"
proxy = "direct"
replacements = ""
{
"module": {
"noProxy": "none",
"noVendor": "",
"private": "*.*",
"proxy": "direct",
"replacements": ""
}
}
- noVendor
- A optional Glob pattern matching module paths to skip when vendoring, e.g. “github.com/**”
- proxy
- Defines the proxy server to use to download remote modules. Default is
direct
, which means “git clone” and similar. - noProxy
- Comma separated glob list matching paths that should not use the proxy configured above.
- private
- Comma separated glob list matching paths that should be treated as private.
- replacements
- A comma separated (or a slice) list of module path to directory replacement mapping, e.g.
"github.com/bep/myprettytheme -> ../..,github.com/bep/shortcodes -> /some/path
. This is mostly useful for temporary locally development of a module, and then it makes sense to set it as an OS environment variable, e.g:env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.."
. Any relative path is relate to themesDir, and absolute paths are allowed.
Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example:
env HUGO_MODULE_PROXY=https://proxy.example.org hugo
Module Config: hugoVersion
If your module requires a particular version of Hugo to work, you can indicate that in the module
section and the user will be warned if using a too old/new version.
config.
module:
hugoVersion:
extended: false
max: ""
min: ""
[module]
[module.hugoVersion]
extended = false
max = ""
min = ""
{
"module": {
"hugoVersion": {
"extended": false,
"max": "",
"min": ""
}
}
}
Any of the above can be omitted.
- min
- The minimum Hugo version supported, e.g.
0.55.0
- max
- The maximum Hugo version supported, e.g.
0.55.0
- extended
- Whether the extended version of Hugo is required.
Module Config: imports
config.
module:
imports:
- disable: false
ignoreConfig: false
path: github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v
- path: my-shortcodes
[module]
[[module.imports]]
disable = false
ignoreConfig = false
path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
[[module.imports]]
path = "my-shortcodes"
{
"module": {
"imports": [
{
"disable": false,
"ignoreConfig": false,
"path": "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
},
{
"path": "my-shortcodes"
}
]
}
}
- path
- Can be either a valid Go Module module path, e.g.
github.com/gohugoio/myShortcodes
, or the directory name for the module as stored in your themes folder. - ignoreConfig
- If enabled, any module configuration file, e.g.
config.toml
, will not be loaded. Note that this will also stop the loading of any transitive module dependencies. - disable
- Set to
true
to disable the module while keeping any version info in thego.*
files.
Module Config: mounts
Default mounts
config.
module:
mounts:
- source: content
target: content
- source: static
target: static
- source: layouts
target: layouts
- source: data
target: data
- source: assets
target: assets
- source: i18n
target: i18n
- source: archetypes
target: archetypes
[module]
[[module.mounts]]
source = "content"
target = "content"
[[module.mounts]]
source = "static"
target = "static"
[[module.mounts]]
source = "layouts"
target = "layouts"
[[module.mounts]]
source = "data"
target = "data"
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "i18n"
target = "i18n"
[[module.mounts]]
source = "archetypes"
target = "archetypes"
{
"module": {
"mounts": [
{
"source": "content",
"target": "content"
},
{
"source": "static",
"target": "static"
},
{
"source": "layouts",
"target": "layouts"
},
{
"source": "data",
"target": "data"
},
{
"source": "assets",
"target": "assets"
},
{
"source": "i18n",
"target": "i18n"
},
{
"source": "archetypes",
"target": "archetypes"
}
]
}
}
- source
- The source directory of the mount. For the main project, this can be either project-relative or absolute and even a symbolic link. For other modules it must be project-relative.
- target
- Where it should be mounted into Hugo’s virtual filesystem. It must start with one of Hugo’s component folders:
static
,content
,layouts
,data
,assets
,i18n
, orarchetypes
. E.g.content/blog
. - lang
- The language code, e.g. “en”. Only relevant for
content
mounts, andstatic
mounts when in multihost mode.