I’ve encountered an issue in Hugo where taxonomy term pages (_index.md under content/tags/<term>/) fail to expose .Page.Description and .Page.Weight when the title in the front matter contains a dash (-), even though .Page.Title still works.
Setup
- Hugo config (
config.yaml):
taxonomies:
tag: tags
- Content front matter example:
tags:
- Shift-Left Strategy
- Taxonomy term page:
content/tags/shift-left-strategy/_index.md
With front matter:
---
title: Shift-Left Strategy
description: A Shift-Left Strategy brings testing, security, and compliance earlier...
weight: 175
---
Sample template code
Here’s the template code used to render the taxonomy terms:
{{ $tags := slice }}
{{ range $name, $pages := .Site.Taxonomies.tags }}
{{ $count := len (where $pages "Draft" "!=" true) }}
{{ $tags = $tags | append (dict "name" $name "count" $count "pages" $pages "page" .Page) }}
{{ end }}
{{ $sorted := sort $tags "page.Weight" "asc" }}
{{ range first 20 $sorted }}
<div class="d-flex align-items-center">
<span class="text-truncate d-inline-block" style="max-width: 100%;" title="{{ .name }}">
<a href="{{ .page.Permalink }}" title="{{ .page.Title }} - {{ .page.Description }}">{{ .page.Title }}</a>
</span>
<span class="ms-1">({{ .count }}){{- if ne hugo.Environment "production" }}[W:{{ .page.Weight }}]{{ end }}</span>
</div>
{{ end }}
What works
.Page.Titleoutputs correctly asShift-Left Strategy.- The taxonomy page renders at
/tags/shift-left-strategy/. .Page.Descriptionand.Page.Weightwork correctly on all other tags (for example,Product Management→product-management).
What fails
For the specific taxonomy term Shift-Left Strategy, .Page.Description and .Page.Weight are empty.
Even .Page.Params.description and .Page.Params.weight are empty.
The template outputs only the title; description and weight are missing.
How I resolved it
Changing the front matter to:
title: Shift Left Strategy
slug: shift-left-strategy
fixed the issue:
.Page.Descriptionand.Page.Weightbecame available.- The URL stayed correct at
/tags/shift-left-strategy/.
Expected behavior
Hugo should correctly surface description and weight from _index.md to .Page on taxonomy term pages, even if the title contains a dash (-).
Environment
- Hugo version: [insert your Hugo version here, e.g., 0.124.1]
- Build environment: [insert OS or deployment environment, e.g., macOS, Windows, Netlify]
Reproduction steps
- Define a taxonomy
tagsin config.yaml. - Add
tags: ["Shift-Left Strategy"]to content pages. - Create
_index.mdundercontent/tags/shift-left-strategy/withtitle: Shift-Left Strategy,description, andweight. - Render the taxonomy template using the sample code above.
- Observe that
.Page.Descriptionand.Page.Weightare empty.
Notes
This issue does not occur for tags like Product Management → product-management, only for tags with dashes in the title.