fix: some tag and category links are broken

Links may break due to breaking changes in GetPage in Hugo 0.55.2+.

Solution: add explicit urlize to taxonomy term GetPage call

Fix #1053
This commit is contained in:
George Cushen committed 2019-04-26 08:50:50 +01:00
1 parent 2edf7cf351
commit 925d781bb0
2 files changed
+10 -14

No files matched your search

+6 -8
View File
@@ -55,19 +55,17 @@
<a href="{{ $page.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
{{ end}}
{{ if $page.Params.categories }}
{{ $categoriesLen := len $page.Params.categories }}
{{ if gt $categoriesLen 0 }}
{{ $taxonomy := "categories" }}
{{ with $page.Param $taxonomy }}
<span class="middot-divider"></span>
<span class="article-categories">
<i class="fas fa-folder"></i>
{{ range $k, $v := $page.Params.categories }}
<a href="{{ (site.GetPage (printf "categories/%s" .)).RelPermalink }}">{{ . }}</a>
{{- if lt $k (sub $categoriesLen 1) -}}, {{ end }}
{{ end }}
{{ range $index, $value := . -}}
{{- if gt $index 0 }}, {{ end -}}
<a href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a>
{{- end -}}
</span>
{{ end }}
{{ end }}
{{ if $share }}
{{ partial "share.html" $ }}
+4 -6
View File
@@ -1,10 +1,8 @@
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
{{ $taxonomy := "tags" }}
{{ with .Param $taxonomy }}
<div class="article-tags">
{{ range $k, $v := $.Params.tags }}
<a class="badge badge-light" href="{{ (site.GetPage (printf "tags/%s" .)).RelPermalink }}">{{ . }}</a>
{{ range $index, $value := . }}
<a class="badge badge-light" href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a>
{{ end }}
</div>
{{ end }}
{{ end }}