First observed in Hugo extended 0.83.1, reproduced in Hugo extended 0.91.0. Output of hugo env
:
hugo v0.91.0-D1DC0E9A+extended linux/amd64 BuildDate=2021-12-17T09:50:20Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.17.5"
When a taxonomy term ends in a period (and maybe other punctuation?) it behaves inconsistently. (Periods within the term are fine.)
Specifically, I’ve observed the following:
- Within each page that has an affected taxonomy term, the term is found within the page’s
.params
. (As expected.) - Within the taxonomy page’s
.Pages
, the affected term’s page is found. (As expected.) - A
.Site.GetPage
call with the path to an affected term’s page does not return the page, but instead anopPage
. (Not expected.) (Similar calls to other terms in the same taxonomy return the term’s page as expected.) - Navigating through
.Site.Taxonomies
or the term page’s.Pages
for pages with the affected term does not find all of them - in my below repro, the Home page is found while the regular page is not despite them both having the affected terms. (Not expected.) (For other terms, both pages are found.)
My minimal repro is a fresh site from hugo new site
with the following added:
content/_index.md
---
title: "Home"
categories: ["Normal", "Period.middle", "Periodend."]
tags: ["Normal", "Period.middle", "Periodend."]
---
content/page/item.md
---
title: "Item"
categories: ["Normal", "Period.middle", "Periodend."]
tags: ["Normal", "Period.middle", "Periodend."]
---
layouts/index.html
and layouts/_default/single.html
<html>
<body>
<h1>{{ .Title }}</h1>
<h2>This page's categories:</h2>
<ul>
{{- range .Params.categories }}
<li>{{ . }} {{ with $.Site.GetPage (print "/categories/" (urlize .)) }} <a href="{{ .Permalink }}">(Page)</a>{{ end }}</li>
{{- end }}
</ul>
<h2>This page's tags:</h2>
<ul>
{{- range .Params.tags }}
<li>{{ . }} {{ with $.Site.GetPage (print "/tags/" (urlize .)) }} <a href="{{ .Permalink }}">(Page)</a>{{ end }}</li>
{{- end }}
</ul>
<h2>Site taxonomies:</h2>
<ul>
{{- range $taxonomyname, $taxonomy := .Site.Taxonomies }}
<li>{{ title $taxonomyname }} ({{ len $taxonomy }}):
<ul>
{{- range $taxonomy }}
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }} ({{ .Count }})</a></li>
{{- end }}
</ul>
</li>
{{- end }}
</ul>
</body>
</html>
layouts/_default/list.html
<h1>{{ .Title }}</h1>
<ul>
{{- range .Pages.ByTitle }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{- end }}
</ul>
This is a home page and a regular page that both have tags and categories of ["Normal", "Period.middle", "Periodend."]
. Each page lists its own tags and categories and those of the site. For both, it shows all three tags/categories (but fails to link to the page for “Periodend.” because the .GetPage
call returned a nopPage
). They also show all three tags/categories for the site, but “Periodend.” only has a count of “1” because only the regular page is counted.