hugo/hugolib
Bjørn Erik Pedersen 1f1c62e6c7 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
2024-03-16 15:53:26 +01:00
..
doctree
filesystems common/hugo: Rename IsMultiHost and IsMultiLingual 2024-03-13 17:34:42 +02:00
paths
segments Add segments config + --renderSegments flag 2024-03-16 15:53:26 +01:00
testdata
testsite
404_test.go
alias.go
alias_test.go
breaking_changes_test.go
cascade_test.go Fix panic when cascading headless from site config to section that does not have an _index.md file 2024-02-28 19:26:55 +01:00
codeowners.go
collections.go
collections_test.go
config.go
config_test.go common/hugo: Rename IsMultiHost and IsMultiLingual 2024-03-13 17:34:42 +02:00
configdir_test.go
content_factory.go
content_factory_test.go
content_map.go Fix panic for disableKinds page for content resources 2024-02-25 11:38:52 +01:00
content_map_page.go Fix translationKey handling for term pages 2024-03-15 16:54:18 +01:00
content_map_test.go Fix section page resource not published if resource filename partially matches content file name 2024-03-07 09:50:50 +01:00
content_render_hooks_test.go
datafiles_test.go Fix assets vs data issue 2024-02-28 19:26:55 +01:00
dates_test.go all: Fix typos and some URLs 2024-02-18 12:16:30 +01:00
disableKinds_test.go
embedded_shortcodes_test.go
embedded_templates_test.go
fileInfo.go
fileInfo_test.go
frontmatter_test.go
gitinfo.go
hugo_modules_test.go
hugo_sites.go Add segments config + --renderSegments flag 2024-03-16 15:53:26 +01:00
hugo_sites_build.go Add segments config + --renderSegments flag 2024-03-16 15:53:26 +01:00
hugo_sites_build_errors_test.go
hugo_sites_build_test.go
hugo_sites_multihost_test.go common/hugo: Rename IsMultiHost and IsMultiLingual 2024-03-13 17:34:42 +02:00
hugo_sites_test.go
hugo_smoke_test.go
hugolib_integration_test.go
image_test.go
integrationtest_builder.go Fix and add integration test for the Bootstrap SCSS module for both Dart Sass and Libsass 2024-03-01 14:18:52 +01:00
language_content_dir_test.go
language_test.go
menu_test.go
minify_publisher_test.go
mount_filters_test.go Fix Name for nested resourced fetched in resources.ByName and similar 2024-03-13 18:59:50 +02:00
page.go Add segments config + --renderSegments flag 2024-03-16 15:53:26 +01:00
page__common.go
page__content.go
page__data.go
page__fragments_test.go
page__menus.go
page__meta.go hugolib: Deprecate site methods Author, Authors, and Social 2024-03-15 17:26:45 +01:00
page__meta_test.go Fix draft for non-default content when content in default language does not exist 2024-02-28 19:26:55 +01:00
page__new.go Fix taxonomy kind template lookup issue 2024-03-07 09:50:50 +01:00
page__output.go
page__paginator.go
page__paths.go all: Fix typos and some URLs 2024-02-18 12:16:30 +01:00
page__per_output.go
page__position.go
page__ref.go
page__tree.go Fix .Parent when there are overlapping regular pages inbetween 2024-03-16 14:48:04 +01:00
page_kinds.go
page_permalink_test.go
page_test.go Fix translationKey handling for term pages 2024-03-15 16:54:18 +01:00
page_unwrap.go
page_unwrap_test.go
pagebundler_test.go resource: Revert the normalization of Resource.Name 2024-02-25 14:57:29 +01:00
pagecollections.go Speed up GetPage 2024-02-23 16:29:21 +01:00
pagecollections_test.go Fix .Page.Pages with similary named sections 2024-02-28 16:43:19 +01:00
pages_capture.go Fix server rebuilds when adding sub sections especially on Windows 2024-03-15 15:42:56 +01:00
pages_language_merge_test.go
pages_test.go
paginator_test.go
params_test.go
permalinker.go
prune_resources.go
rebuild_test.go Fix panic when changing archetype files when servere is running 2024-03-13 19:35:28 +02:00
rendershortcodes_test.go
renderstring_test.go
resource_chain_test.go
robotstxt_test.go Fix robots.txt using the built-in template regression 2024-02-20 11:17:44 +01:00
rss_test.go
securitypolicies_test.go
shortcode.go all: Fix typos and some URLs 2024-02-18 12:16:30 +01:00
shortcode_page.go
shortcode_test.go
site.go hugolib: Remove Site.HomeAbsURL 2024-03-16 12:49:40 +01:00
site_benchmark_new_test.go
site_new.go hugolib: Deprecate site methods Author, Authors, and Social 2024-03-15 17:26:45 +01:00
site_output.go
site_output_test.go
site_render.go Add segments config + --renderSegments flag 2024-03-16 15:53:26 +01:00
site_sections.go
site_sections_test.go Fix .Parent when there are overlapping regular pages inbetween 2024-03-16 14:48:04 +01:00
site_stats_test.go
site_test.go Fix relref regression with trailing slash 2024-02-21 17:27:45 +01:00
site_url_test.go
siteJSONEncode_test.go
sitemap_test.go hugolib: Fix sitemap index with monolingual site 2024-03-16 11:49:00 +01:00
taxonomy_test.go Don't auto-create empty sections for nested taxonomies 2024-03-07 09:50:50 +01:00
template_test.go
testhelpers_test.go