mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'
This commit is contained in:
@@ -20,8 +20,6 @@ toc: true
|
||||
|
||||
{{< gomodules-info >}}
|
||||
|
||||
|
||||
|
||||
## Initialize a New Module
|
||||
|
||||
Use `hugo mod init` to initialize a new Hugo Module. If it fails to guess the module path, you must provide it as an argument, e.g.:
|
||||
@@ -33,6 +31,7 @@ hugo mod init github.com/gohugoio/myShortcodes
|
||||
Also see the [CLI Doc](/commands/hugo_mod_init/).
|
||||
|
||||
## Use a Module for a Theme
|
||||
|
||||
The easiest way to use a Module for a theme is to import it in the config.
|
||||
|
||||
1. Initialize the hugo module system: `hugo mod init github.com/<your_user>/<your_project>`
|
||||
@@ -60,8 +59,6 @@ hugo mod get -u
|
||||
|
||||
### Update All Modules Recursively
|
||||
|
||||
{{< new-in "0.65.0" >}}
|
||||
|
||||
```bash
|
||||
hugo mod get -u ./...
|
||||
```
|
||||
@@ -71,6 +68,7 @@ hugo mod get -u ./...
|
||||
```bash
|
||||
hugo mod get -u github.com/gohugoio/myShortcodes
|
||||
```
|
||||
|
||||
### Get a Specific Version
|
||||
|
||||
```bash
|
||||
@@ -89,16 +87,15 @@ replace github.com/bep/hugotestmods/mypartials => /Users/bep/hugotestmods/mypart
|
||||
|
||||
If you have the `hugo server` running, the configuration will be reloaded and `/Users/bep/hugotestmods/mypartials` put on the watch list.
|
||||
|
||||
Note that since v.0.77.0 you can use modules config [`replacements`](https://gohugo.io/hugo-modules/configuration/#module-config-top-level) option. {{< new-in "0.77.0" >}}
|
||||
Instead of modifying the `go.mod` files, you can also use the modules config [`replacements`](https://gohugo.io/hugo-modules/configuration/#module-config-top-level) option.
|
||||
|
||||
## Print Dependency Graph
|
||||
|
||||
|
||||
Use `hugo mod graph` from the relevant module directory and it will print the dependency graph, including vendoring, module replacement or disabled status.
|
||||
|
||||
E.g.:
|
||||
|
||||
```
|
||||
```txt
|
||||
hugo mod graph
|
||||
|
||||
github.com/bep/my-modular-site github.com/bep/hugotestmods/mymounts@v1.2.0
|
||||
@@ -121,11 +118,10 @@ Note that:
|
||||
|
||||
* You can run `hugo mod vendor` on any level in the module tree.
|
||||
* Vendoring will not store modules stored in your `themes` folder.
|
||||
* Most commands accept a `--ignoreVendorPaths` flag, which will then not use the vendored modules in `_vendor` for the module paths matching the [Glob](https://github.com/gobwas/glob) pattern given. Note that before Hugo 0.75 this flag was named `--ignoreVendor` and was a "all or nothing". {{< new-in "0.75.0" >}}
|
||||
* Most commands accept a `--ignoreVendorPaths` flag, which will then not use the vendored modules in `_vendor` for the module paths matching the [Glob](https://github.com/gobwas/glob) pattern given.
|
||||
|
||||
Also see the [CLI Doc](/commands/hugo_mod_vendor/).
|
||||
|
||||
|
||||
## Tidy go.mod, go.sum
|
||||
|
||||
Run `hugo mod tidy` to remove unused entries in `go.mod` and `go.sum`.
|
||||
@@ -138,6 +134,4 @@ Run `hugo mod clean` to delete the entire modules cache.
|
||||
|
||||
Note that you can also configure the `modules` cache with a `maxAge`, see [File Caches](/getting-started/configuration/#configure-file-caches).
|
||||
|
||||
|
||||
|
||||
Also see the [CLI Doc](/commands/hugo_mod_clean/).
|
||||
|
Reference in New Issue
Block a user