hugo/content/en/hugo-modules/configuration.md
Bjørn Erik Pedersen e556848805 Squashed 'docs/' changes from 4895c29c5..9abd3043a
9abd3043a Add docs for shimming JS libraries
6a1c8dcd7 Update sitemap-template.md (#1245)
37c397332 Update frontends.md
a0f86f6df Update configuration.md
bb00cb2c1 Update page-bundles.md
773212de6 Restructure and simplify
fcba7dddf Some minor clarifications of weight sorting
759b967fc Update configuration-markup.md
56708f0b7 module import path remove slash at end
59f4f4acd Doc: Fix typo in hugo command
faacf2e97 Clarify pagination documentation (#1208)
d8eb60887 netlify: Bump to 0.75.1
8cedf6231 Merge branch 'temp751'
188e2bf56 releaser: Add release notes to /docs for release of 0.75.1
c96d4b7a3 Update index.md
1a9d192f7 Update index.md
32731b916 Update index.md
a5bfa0c9a Restore the ... home page
b6850bf96 Release 0.75.0
d6e5e624f releaser: Add release notes to /docs for release of 0.75.0
8cd6b4f47 typo: already -> already
2cb2b22bb Merge commit '534ae9c57a902aea9ed6e62390dec11fa74b7122'
e3525de23 docs: Regen docs helper
fd746dd83 docs: Regenerate CLI docs
e20127980 Add "hugo mod npm pack"
8e82c7ce1 markup/highlight: Add support to linkable line anchors on Chroma
21e94911b markup/asciidocext: Fix AsciiDoc TOC with code
50b8dace5 modules: Add noVendor to module config
d05b541fe modules: Make ignoreVendor a glob pattern
c946082e7 docs: Update replaceRE func
149054341 docs: Update replace func
d917567df docs: Update merge function
f1e093c92 docs: Regen CLI docs
c7bac967d docs: Regen docs helper
7a38f7a45 Merge commit '7d7771b673e5949f554515a2c236b23192c765c8'
1a5a7263a markup/asciidoc: Add support for .TableOfContents

git-subtree-dir: docs
git-subtree-split: 9abd3043a9214b390e8cc148f4588bf630620851
2020-10-06 16:22:20 +02:00

3.9 KiB

title linktitle description date categories keywords menu weight sections_weight toc
Configure Modules Configure Modules This page describes the configuration options for a module. 2019-07-24
hugo modules
themes
source
organization
directories
docs
parent weight
modules 10
10 10 true

Module Config: Top level

{{< code-toggle file="config">}} [module] noVendor = "" proxy = "direct" noProxy = "none" private = "." {{< /code-toggle >}}

noVendor {{< new-in "0.75.0" >}}
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.

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

{{< gomodules-info >}}

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.

{{< code-toggle file="config">}} [module] [module.hugoVersion] min = "" max = "" extended = false

{{< /code-toggle >}}

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

{{< code-toggle file="config">}} [module] module.imports path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v" ignoreConfig = false disable = false module.imports path = "my-shortcodes" {{< /code-toggle >}}

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 the go.* files.

{{< gomodules-info >}}

Module Config: mounts

{{% note %}} When the mounts config was introduced in Hugo 0.56.0, we were careful to preserve the existing staticDir and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a mounts section you should remove the old staticDir etc. settings. {{% /note %}}

{{% warning %}} When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it. {{% /warning %}}

Default mounts {{< code-toggle file="config">}} [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" {{< /code-toggle >}}

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, or archetypes. E.g. content/blog.
lang
The language code, e.g. "en". Only relevant for content mounts, and static mounts when in multihost mode.