docs/content/en/configuration/segments.md
[!note] The
segmentsconfiguration applies only to segmented rendering. While it controls when content is rendered, it doesn't restrict access to Hugo's complete object graph (sites and pages), which remains fully available.
Segmented rendering offers several advantages:
Each segment is defined by include and exclude filters:
Available fields for filtering:
kind
: (string) A glob pattern matching the page kind. For example: {taxonomy,term}.
sites
: {{< new-in 0.153.0 />}}
: (map) A map to define sites matrix.
output
: (string) A glob pattern matching the output format of the page. For example: {html,json}.
path
: (string) A glob pattern matching the page's logical path. For example: {/books,/books/**}.
Place broad filters, such as those for language or output format, in the excludes section. For example:
{{< code-toggle file=hugo >}} [segments.segment1] [[segments.segment1.excludes]] lang = 'n*' [[segments.segment1.excludes]] lang = 'en' output = 'rss' [[segments.segment1.includes]] kind = '{home,term,taxonomy}' [[segments.segment1.includes]] path = '{/docs,/docs/**}' {{< /code-toggle >}}
Render specific segments using the renderSegments configuration or the --renderSegments flag:
hugo build --renderSegments segment1
You can configure multiple segments and use a comma-separated list with --renderSegments to render them all.
hugo build --renderSegments segment1,segment2