c43daf45f Update build-options.md 3ebbfedd4 Build options: Improve readability 5091bf6a0 Improve safeHTMLAttr explanation b64cbce2e Fix description of collections.Apply 6ea264b9c netlify: Hugo 0.115.4 b42e7c542 Revert "config: Remove disableLiveReload" 35ce2290e Remove excess spaces in configuration docs 2edf761de Update listed titleCaseStyle default value 887f6fb97 config: Remove disableLiveReload c9f49fb26 Fix typo 37d8569ac Remove tools associated with Atom 871d11b72 Fix URL in postprocess docs bbb17d29f Update GitLab workflow bc53ea5ce Use sentence-style capitalization for headings 7ca578786 netlify: Hugo 0.115.3 c5e010bd0 Merge branch 'tempv0.115.3' c885604bf Remove starter kits page 4c0fe269e Update mention of Netlify CMS to Decap CMS 05067175c Consistently use file name instead of filename 763dd6404 Improve multilingual config example and descriptions e5aa61ec5 Use lowercase when referring to front matter (#2132) 7ba3d0c72 docs: Refresh docs.json de8bddedf Update description of timeout configuration value e1245d9f8 netify: Hugo 0.115.2 153a36bdf Merge branch 'tempv0.115.2' 707cec754 Fix typo in figure example in shortcodes.md 128cbe1e5 Improve taxonomy template examples 4e743ec36 Improve highlight function example f96fa6805 transpile sass: Fixes typo e4a8a21f7 Compile Sass to CSS, not SCSS c1538bd00 docs: Regenerate CLI docs bd4e33436 Add titleCaseStyle none and firstupper 6ff93d478 Update quick-start.md 5c6653cb1 Update build config examples and explanation 1458d9a43 Remove the `url` parameter 6a1e92044 netlify: Hugo 0.115.1 a9d5d6f2f Merge branch 'tempv0.115.1' 4c4882384 docs: Regen docs helper d1aa1c1f5 Add link to PowerShell vs Windows PowerShell documentation 6e3b70c21 Fix link to Git installation instructions 4f8a9ca38 Clarify resources.Copy arguments ee86dd121 Update theme dc7c305cf Update theme 60c23920b Clarify caching for resources.FromString (#2120) 5bf2fef6d netlify: Hugo 0.115.0 46bde87c5 Merge branch 'tempv0.115.0' 42cc48c16 Specify target path caching for resources.ExecuteAsTemplate (#2027) a54bf4cd0 Correct the sample code of mermaid (#2119) 8c49b06fc docs: Update permalinks documentation a4818d99b Page bundles: link to info about single vs. list page templates (#2116) 3fc7744d7 snap: Document removable media access dbd08f58a Update theme df5b88633 netlify: Hugo 0.114.1 6b859834a Fix typo 9ec92cf68 Improve Dart Sass example for Netlify 2d294ece9 Add Dart Sass installation and usage documentation 4c6b77d6c Fix placement of curly braces 897812a50 Update template-debugging.md to include a jsonify example 22bca519b Update GitHub Pages hosting instructions (#2109) a964d93ce Document math functions new in v0.114.0 (#2108) 9f4cb040e netlify: Hugo 0.114.0 55b4d9221 Merge branch 'tempv0.114.0' 93c4dcf93 docs: Regen docshelper 96f03c77f docs: Regen CLI docs 8e22a228a Clarify resource media type variables (#2106) 2652da8d4 Update transform.Unmarshal.md (#2105) 92657177a Update theme 4601c1d65 Update theme a216f3145 Merge commit '3c1deaf201a35de08d23cc58f8f03682cace3349' eed8794f5 cache: Set default cache path based on $USER git-subtree-dir: docs git-subtree-split: c43daf45fdc36c254f4274a0815ea62d4d8c37e0
6.1 KiB
title | description | categories | keywords | menu | weight | toc | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Configure Hugo modules | This page describes the configuration options for a module. |
|
|
|
20 | true |
Module configuration: top level
{{< code-toggle file="hugo" >}} [module] noVendor = "" proxy = "direct" noProxy = "none" private = "." replacements = "" workspace = "off" {{< /code-toggle >}}
- noVendor
- A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
- vendorClosest
- When enabled, we will pick the vendored module closest to the module using it. The default behavior is to pick the first. Note that there can still be only one dependency of a given module path, so once it is in use it cannot be redefined.
- 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.
- workspace
- The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g.
export HUGO_MODULE_WORKSPACE=/my/hugo.work
This only works with Go 1.18+. In Hugov0.109.0
we changed the default tooff
and we now resolve any relative work file names relative to the working directory. - replacements
- A comma-separated list of mappings from module paths to directories, e.g.
github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path
. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g:env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."
. Relative paths are relative to themesDir. 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
{{< gomodules-info >}}
Module configuration: 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="hugo" >}} [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 configuration: imports
{{< code-toggle file="hugo" >}} [module] module.imports path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v" ignoreConfig = false ignoreImports = 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.
hugo.toml
, will not be loaded. Note that this will also stop the loading of any transitive module dependencies. - ignoreImports
- If enabled, module imports will not be followed.
- disable
- Set to
true
to disable the module while keeping any version info in thego.*
files. - noMounts
- Do not mount any folder in this import.
- noVendor
- Never vendor this import (only allowed in main project).
{{< gomodules-info >}}
Module configuration: mounts
{{% note %}}
When the mounts
configuration was introduced in Hugo 0.56.0, we were careful to preserve the existing contentDir
, 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 contentDir
, staticDir
, etc. settings.
{{% /note %}}
{{% note %}} When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it. {{% /note %}}
Default mounts {{< code-toggle file="hugo" >}} [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
, orarchetypes
. E.g.content/blog
. - lang
- The language code, e.g. "en". Only relevant for
content
mounts, andstatic
mounts when in multihost mode. - includeFiles (string or slice)
- One or more glob patterns matching files or directories to include. If
excludeFiles
is not set, the files matchingincludeFiles
will be the files mounted.
The glob patterns are matched to the file names starting from the source
root, they should have Unix styled slashes even on Windows, /
matches the mount root and **
can be used as a super-asterisk to match recursively down all directories, e.g /posts/**.jpg
.
The search is case-insensitive.
- excludeFiles (string or slice)
- One or more glob patterns matching files to exclude.
Example {{< code-toggle file="hugo" >}} [module] module.mounts source="content" target="content" excludeFiles="docs/*" module.mounts source="node_modules" target="assets" module.mounts source="assets" target="assets" {{< /code-toggle >}}