module.md - hugo - [fork] hugo port for 9front
 (HTM) git clone https://git.drkhsh.at/hugo.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
       module.md (6633B)
       ---
            1 ---
            2 title: Configure modules
            3 linkTitle: Modules
            4 description: Configure modules.
            5 categories: []
            6 keywords: []
            7 aliases: [/hugo-modules/configuration/]
            8 ---
            9 
           10 ## Top-level options
           11 
           12 This is the default configuration:
           13 
           14 {{< code-toggle file=hugo >}}
           15 [module]
           16 noProxy = 'none'
           17 noVendor = ''
           18 private = '*.*'
           19 proxy = 'direct'
           20 vendorClosest = false
           21 workspace = 'off'
           22 {{< /code-toggle >}}
           23 
           24 auth
           25 : {{< new-in 0.144.0 />}}
           26 : (`string`) Configures `GOAUTH` when running the Go command for module operations. This is a semicolon-separated list of authentication commands for go-import and HTTPS module mirror interactions. This is useful for private repositories. See `go help goauth` for more information.
           27 
           28 noProxy
           29 : (`string`) A comma-separated list of [glob](g) patterns matching paths that should not use the [configured proxy server](#proxy).
           30 
           31 noVendor
           32 : (`string`) A [glob](g) pattern matching module paths to skip when vendoring.
           33 
           34 private
           35 : (`string`) A comma-separated list of [glob](g) patterns matching paths that should be treated as private.
           36 
           37 proxy
           38 : (`string`) The proxy server to use to download remote modules. Default is `direct`, which means `git clone` and similar.
           39 
           40 replacements
           41 : (`string`) Primarily useful for local module development, a comma-separated list of mappings from module paths to directories. Paths may be absolute or relative to the [`themesDir`].
           42 
           43   {{< code-toggle file=hugo >}}
           44   [module]
           45   replacements = 'github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path'
           46   {{< /code-toggle >}}
           47 
           48 vendorClosest
           49 : (`bool`) Whether to 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. Default is `false`.
           50 
           51 workspace
           52 : (`string`) The Go workspace file to use, either as an absolute path or a path relative to the current working directory. Enabling this activates Go workspace mode and requires Go 1.18 or later. The default is `off`.
           53 
           54 You may also use environment variables to set any of the above. For example:
           55 
           56 ```sh
           57 export HUGO_MODULE_PROXY="https://proxy.example.org"
           58 export HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."
           59 export HUGO_MODULE_WORKSPACE="/my/hugo.work"
           60 ```
           61 
           62 {{% include "/_common/gomodules-info.md" %}}
           63 
           64 ## Hugo version
           65 
           66 You can specify a required Hugo version for your module in the `module` section. Users will then receive a warning if their Hugo version is incompatible.
           67 
           68 This is the default configuration:
           69 
           70 {{< code-toggle config=module.hugoVersion />}}
           71 
           72 You can omit any of the settings above.
           73 
           74 extended
           75 : (`bool`) Whether the extended edition of Hugo is required, satisfied by installing either the extended or extended/deploy edition.
           76 
           77 max
           78 : (`string`) The maximum Hugo version supported, for example `0.143.0`.
           79 
           80 min
           81 : (`string`) The minimum Hugo version supported, for example `0.123.0`.
           82 
           83 [`themesDir`]: /configuration/all/#themesdir
           84 
           85 ## Imports
           86 
           87 {{< code-toggle file=hugo >}}
           88 [[module.imports]]
           89 disable = false
           90 ignoreConfig = false
           91 ignoreImports = false
           92 path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
           93 [[module.imports]]
           94 path = "my-shortcodes"
           95 {{< /code-toggle >}}
           96 
           97 disable
           98 : (`bool`) Whether to disable the module but keep version information in the `go.*` files. Default is `false`.
           99 
          100 ignoreConfig
          101 : (`bool`) Whether to ignore module configuration files, for example, `hugo.toml`. This will also prevent loading of any transitive module dependencies. Default is `false`.
          102 
          103 ignoreImports
          104 : (`bool`) Whether to ignore module imports. Default is `false`.
          105 
          106 noMounts
          107 : (`bool`) Whether to disable directory mounting for this import. Default is `false`.
          108 
          109 noVendor
          110 : (`bool`) Whether to disable vendoring for this import. This setting is restricted to the main project. Default is `false`.
          111 
          112 path
          113 : (`string`) The module path, either a valid Go module path (e.g., `github.com/gohugoio/myShortcodes`) or the directory name if stored in the [`themesDir`].
          114 
          115 [`themesDir`]: /configuration/all#themesDir
          116 
          117 {{% include "/_common/gomodules-info.md" %}}
          118 
          119 ## Mounts
          120 
          121 Before Hugo v0.56.0, custom component paths could only be configured by setting [`archetypeDir`], [`assetDir`], [`contentDir`], [`dataDir`], [`i18nDir`], [`layoutDi`], or [`staticDir`] in the site configuration. Module mounts offer greater flexibility than these legacy settings, but
          122 you cannot use both.
          123 
          124 [`archetypeDir`]: /configuration/all/
          125 [`assetDir`]: /configuration/all/
          126 [`contentDir`]: /configuration/all/
          127 [`dataDir`]: /configuration/all/
          128 [`i18nDir`]: /configuration/all/
          129 [`layoutDi`]: /configuration/all/
          130 [`staticDir`]: /configuration/all/
          131 
          132 > [!note]
          133 > If you use module mounts do not use the legacy settings.
          134 
          135 ### Default mounts
          136 
          137 > [!note]
          138 > Adding a new mount to a target root will cause the existing default mount for that root to be ignored. If you still need the default mount, you must explicitly add it along with the new mount.
          139 
          140 The are the default mounts:
          141 
          142 {{< code-toggle config=module.mounts />}}
          143 
          144 source
          145 : (`string`) The source directory of the mount. For the main project, this can be either project-relative or absolute. For other modules it must be project-relative.
          146 
          147 target
          148 : (`string`) Where the mount will reside within Hugo's virtual file system. It must begin with one of Hugo's component directories: `archetypes`, `assets`, `content`, `data`, `i18n`, `layouts`, or `static`. For example, `content/blog`.
          149 
          150 disableWatch
          151 : {{< new-in 0.128.0 />}}
          152 : (`bool`) Whether to disable watching in watch mode for this mount. Default is `false`.
          153 
          154 lang
          155 : (`string`) The language code, e.g. "en". Relevant for `content` mounts, and `static` mounts when in multihost mode.
          156 
          157 includeFiles
          158 : (`string` or `[]string`) One or more [glob](g) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
          159 
          160   The glob patterns are matched against file names relative to the source root. Use Unix-style forward slashes (`/`), even on Windows. A single forward slash (`/`) matches the mount root, and double asterisks (`**`) act as a recursive wildcard, matching all directories and files beneath a given point (e.g., `/posts/**.jpg`). The search is case-insensitive.
          161 
          162 excludeFiles
          163 : (`string` or `[]string`) One or more [glob](g) patterns matching files to exclude.
          164 
          165 ### Example
          166 
          167 {{< code-toggle file=hugo >}}
          168 [module]
          169 [[module.mounts]]
          170     source="content"
          171     target="content"
          172     excludeFiles="docs/*"
          173 [[module.mounts]]
          174     source="node_modules"
          175     target="assets"
          176 [[module.mounts]]
          177     source="assets"
          178     target="assets"
          179 {{< /code-toggle >}}