Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'

This commit is contained in:
Bjørn Erik Pedersen
2023-12-04 15:24:01 +01:00
810 changed files with 24147 additions and 7766 deletions

View File

@@ -2,16 +2,16 @@
title: Hugo Modules
linkTitle: Overview
description: How to use Hugo Modules.
categories: []
keywords: []
menu:
docs:
identifier: hugo-modules-overview
parent: modules
weight: 10
weight: 10
categories: [hugo modules]
keywords: [themes,modules]
aliases: [/themes/overview/,/themes/]
toc: true
aliases: [/themes/overview/,/themes/]
---
**Hugo Modules** are the core building blocks in Hugo. A _module_ can be your main project or a smaller module providing one or more of the 7 component types defined in Hugo: **static**, **content**, **layouts**, **data**, **assets**, **i18n**, and **archetypes**.

View File

@@ -2,7 +2,7 @@
title: Configure Hugo modules
description: This page describes the configuration options for a module.
categories: [hugo modules]
keywords: [themes, source, organization, directories]
keywords: [modules,themes]
menu:
docs:
parent: modules
@@ -13,7 +13,7 @@ toc: true
## Module configuration: top level
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[module]
noVendor = ""
proxy = "direct"
@@ -56,7 +56,7 @@ env HUGO_MODULE_PROXY=https://proxy.example.org hugo
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" >}}
{{< code-toggle file=hugo >}}
[module]
[module.hugoVersion]
min = ""
@@ -78,7 +78,7 @@ extended
## Module configuration: imports
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[module]
[[module.imports]]
path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
@@ -120,7 +120,7 @@ When you add a mount, the default mount for the concerned target root is ignored
{{% /note %}}
**Default mounts**
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[module]
[[module.mounts]]
source="content"
@@ -165,7 +165,7 @@ excludeFiles (string or slice)
: One or more glob patterns matching files to exclude.
**Example**
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[module]
[[module.mounts]]
source="content"

View File

@@ -2,7 +2,7 @@
title: Theme components
description: Hugo provides advanced theming support with Theme Components.
categories: [hugo modules]
keywords: [themes, theme, source, organization, directories]
keywords: [modules,themes]
menu:
docs:
parent: modules
@@ -12,15 +12,12 @@ aliases: [/themes/customize/,/themes/customizing/]
toc: true
---
{{% note %}}
This section contain information that may be outdated and is in the process of being rewritten.
{{% /note %}}
Since Hugo `0.42` a project can configure a theme as a composite of as many theme components you need:
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
theme = ["my-shortcodes", "base-theme", "hyde"]
{{< /code-toggle >}}
@@ -30,7 +27,7 @@ The theme definition example above in `hugo.toml` creates a theme with 3 theme c
For any given file, data entry, etc., Hugo will look first in the project and then in `my-shortcodes`, `base-theme`, and lastly `hyde`.
Hugo uses two different algorithms to merge the filesystems, depending on the file type:
Hugo uses two different algorithms to merge the file systems, depending on the file type:
* For `i18n` and `data` files, Hugo merges deeply using the translation ID and data key inside the files.
* For `static`, `layouts` (templates), and `archetypes` files, these are merged on file level. So the left-most file will be chosen.

View File

@@ -2,7 +2,7 @@
title: Use Hugo Modules
description: How to use Hugo Modules to build and manage your site.
categories: [hugo modules]
keywords: [install, themes, source, organization, directories,usage,modules]
keywords: [modules,themes]
menu:
docs:
parent: modules
@@ -20,7 +20,7 @@ toc: true
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.:
```bash
```sh
hugo mod init github.com/gohugoio/myShortcodes
```
@@ -33,7 +33,7 @@ The easiest way to use a Module for a theme is to import it in the configuration
1. Initialize the hugo module system: `hugo mod init github.com/<your_user>/<your_project>`
2. Import the theme:
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[module]
[[module.imports]]
path = "github.com/spf13/hyde"
@@ -49,25 +49,25 @@ Some examples:
### Update all modules
```bash
```sh
hugo mod get -u
```
### Update all modules recursively
```bash
```sh
hugo mod get -u ./...
```
### Update one module
```bash
```sh
hugo mod get -u github.com/gohugoio/myShortcodes
```
### Get a specific version
```bash
```sh
hugo mod get github.com/gohugoio/myShortcodes@v1.0.7
```
@@ -77,7 +77,7 @@ Also see the [CLI Doc](/commands/hugo_mod_get/).
One way to do local development of a module imported in a project is to add a replace directive to a local directory with the source in `go.mod`:
```bash
```sh
replace github.com/bep/hugotestmods/mypartials => /Users/bep/hugotestmods/mypartials
```
@@ -101,7 +101,6 @@ github.com/bep/hugotestmods/mypartials@v1.0.7 github.com/bep/hugotestmods/myv2@v
DISABLED github.com/bep/my-modular-site github.com/spf13/hyde@v0.0.0-20190427180251-e36f5799b396
github.com/bep/my-modular-site github.com/bep/hugo-fresh@v1.0.1
github.com/bep/my-modular-site in-themesdir
```
Also see the [CLI Doc](/commands/hugo_mod_graph/).
@@ -134,7 +133,7 @@ Also see the [CLI Doc](/commands/hugo_mod_clean/).
## Module workspaces
{{< new-in "0.109.0" >}}
{{< new-in 0.109.0 >}}
Workspace support was added in [Go 1.18](https://go.dev/blog/get-familiar-with-workspaces) and Hugo got solid support for it in the `v0.109.0` version.
@@ -155,7 +154,7 @@ Using the `use` directive, list all the modules you want to work on, pointing to
With that you can start the Hugo server with that workspace enabled:
```bash
```sh
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
```