mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -2,17 +2,13 @@
|
||||
title: Hugo Modules
|
||||
linktitle: Hugo Modules Overview
|
||||
description: How to use Hugo Modules.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
menu:
|
||||
docs:
|
||||
parent: "modules"
|
||||
parent: modules
|
||||
weight: 01
|
||||
weight: 01
|
||||
sections_weight: 01
|
||||
categories: [hugo modules]
|
||||
keywords: [themes,modules]
|
||||
draft: false
|
||||
aliases: [/themes/overview/,/themes/]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -1,16 +1,13 @@
|
||||
---
|
||||
title: Configure Modules
|
||||
linktitle: Configure Modules
|
||||
description: This page describes the configuration options for a module.
|
||||
date: 2019-07-24
|
||||
categories: [hugo modules]
|
||||
keywords: [themes, source, organization, directories]
|
||||
menu:
|
||||
docs:
|
||||
parent: "modules"
|
||||
parent: modules
|
||||
weight: 10
|
||||
weight: 10
|
||||
sections_weight: 10
|
||||
toc: true
|
||||
---
|
||||
|
||||
@@ -45,7 +42,7 @@ 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 Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work filenames relative to the working directory.
|
||||
|
||||
replacements
|
||||
: A comma separated (or a slice) list of module path to directory replacement mapping, e.g. `github.com/bep/my-theme -> ../..,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/my-theme -> ../.."`. Any relative path is relate to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings), and absolute paths are allowed.
|
||||
: 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](https://gohugo.io/getting-started/configuration/#all-configuration-settings). 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:
|
||||
|
||||
@@ -118,9 +115,9 @@ noVendor
|
||||
When the `mounts` config 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 %}}
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
**Default mounts**
|
||||
{{< code-toggle file="config">}}
|
||||
@@ -166,3 +163,18 @@ The search is case-insensitive.
|
||||
|
||||
excludeFiles (string or slice)
|
||||
: One or more glob patterns matching files to exclude.
|
||||
|
||||
**Example**
|
||||
{{< code-toggle file="config">}}
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
source="content"
|
||||
target="content"
|
||||
excludeFiles="docs/*"
|
||||
[[module.mounts]]
|
||||
source="node_modules"
|
||||
target="assets"
|
||||
[[module.mounts]]
|
||||
source="assets"
|
||||
target="assets"
|
||||
{{< /code-toggle >}}
|
||||
|
@@ -1,17 +1,13 @@
|
||||
---
|
||||
title: Theme Components
|
||||
linktitle: Theme Components
|
||||
description: Hugo provides advanced theming support with Theme Components.
|
||||
date: 2017-02-01
|
||||
categories: [hugo modules]
|
||||
keywords: [themes, theme, source, organization, directories]
|
||||
menu:
|
||||
docs:
|
||||
parent: "modules"
|
||||
parent: modules
|
||||
weight: 50
|
||||
weight: 50
|
||||
sections_weight: 50
|
||||
draft: false
|
||||
aliases: [/themes/customize/,/themes/customizing/]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -1,17 +1,13 @@
|
||||
---
|
||||
title: Use Hugo Modules
|
||||
linktitle: Use Hugo Modules
|
||||
description: How to use Hugo Modules to build and manage your site.
|
||||
date: 2019-07-24
|
||||
categories: [hugo modules]
|
||||
keywords: [install, themes, source, organization, directories,usage,modules]
|
||||
menu:
|
||||
docs:
|
||||
parent: "modules"
|
||||
parent: modules
|
||||
weight: 20
|
||||
weight: 20
|
||||
sections_weight: 20
|
||||
draft: false
|
||||
aliases: [/themes/usage/,/themes/installing/,/installing-and-using-themes/]
|
||||
toc: true
|
||||
---
|
||||
@@ -164,4 +160,3 @@ HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
|
||||
```
|
||||
|
||||
The `--ignoreVendorPaths` flag is added above to ignore any of the vendored dependencies inside `_vendor`. If you don't use vendoring, you don't need that flag. But now the server is set up watching the files and directories in the workspace and you can see your local edits reloaded.
|
||||
|
||||
|
Reference in New Issue
Block a user