Fix categories with special char or spaces not displayed correctly

Call to [`urlize`](https://gohugo.io/functions/urlize/) to get the category url instead of using its name directly.
This commit is contained in:
romainx 2020-10-09 09:49:19 +02:00
parent 809fa7860d
commit 1d95c4b8ff

View File

@ -5,7 +5,7 @@
{{ if $categories }} {{ if $categories }}
<header class="article-category"> <header class="article-category">
{{ range $category := $categories }} {{ range $category := $categories }}
{{ $term := $.Site.GetPage (printf "/categories/%s" $category) }} {{ $term := $.Site.GetPage (printf "/categories/%s" $category | urlize ) }}
{{ if and $image.exists $image.resource }} {{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}} {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}} {{- $20x := $imageRaw.Fill "20x20 smart" -}}