diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-03-04 10:16:56 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-03-16 15:53:26 +0100 |
commit | 1f1c62e6c7fb5c420710fd15ac11995e6c546897 (patch) | |
tree | 4234ab21f7b4c9e73eccaa0276d52413b8cea2bf /docs | |
parent | f1d755965fba9a8d99a4e423c6e231cf7411b4a2 (diff) | |
download | hugo-1f1c62e6c7fb5c420710fd15ac11995e6c546897.tar.gz hugo-1f1c62e6c7fb5c420710fd15ac11995e6c546897.zip |
Add segments config + --renderSegments flag
Named segments can be defined in `hugo.toml`.
* Eeach segment consists of zero or more `exclude` filters and zero or more `include` filters.
* Eeach filter consists of one or more field Glob matchers.
* Eeach filter in a section (`exclude` or `include`) is ORed together, each matcher in a filter is ANDed together.
The current list of fields that can be filtered are:
* path as defined in https://gohugo.io/methods/page/path/
* kind
* lang
* output (output format, e.g. html).
It is recommended to put coarse grained filters (e.g. for language and output format) in the excludes section, e.g.:
```toml
[segments.segment1]
[[segments.segment1.excludes]]
lang = "n*"
[[segments.segment1.excludes]]
no = "en"
output = "rss"
[[segments.segment1.includes]]
term = "{home,term,taxonomy}"
[[segments.segment1.includes]]
path = "{/docs,/docs/**}"
```
By default, Hugo will render all segments, but you can enable filters by setting the `renderSegments` option or `--renderSegments` flag, e.g:
```
hugo --renderSegments segment1,segment2
```
For segment `segment1` in the configuration above, this will:
* Skip rendering of all languages matching `n*`, e.g. `no`.
* Skip rendering of the output format `rss` for the `en` language.
* It will render all pages of kind `home`, `term` or `taxonomy`
* It will render the `/docs` section and all pages below.
Fixes #10106
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions