fixup tag handling ; no longer mangle them (use what we provide!) and do not shuffle (use the order we set!)

This commit is contained in:
KemoNine 2022-12-04 14:09:00 -05:00
parent 161d718664
commit ddde2d77d1

View file

@ -1,16 +1,14 @@
<div class="tags"> <div class="tags">
<p class="clearfix">Tags: <p class="clearfix">Tags:
{{ if (isset . 0) }} {{/* Hack to check if this is an array https://discourse.gohugo.io/t/how-to-check-if-a-variable-is-string-or-array/7460/7 */}} {{ if (isset . 0) }} {{/* Hack to check if this is an array https://discourse.gohugo.io/t/how-to-check-if-a-variable-is-string-or-array/7460/7 */}}
{{ $humanized := apply . "humanize" "." }} {{ range first 1 . }}
{{ $sorted := sort $humanized }}
{{ range first 1 $sorted }}
<a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}"><span itemprop="keyword">{{ . }}</span></a> <a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}"><span itemprop="keyword">{{ . }}</span></a>
{{ end }} {{ end }}
{{ range after 1 $sorted }} {{ range after 1 . }}
&bull; <a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}"><span itemprop="keyword">{{ . }}</span></a> &bull; <a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}"><span itemprop="keyword">{{ . }}</span></a>
{{ end }} {{ end }}
{{ else }} {{ else }}
<a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}"><span itemprop="keyword">{{ . | humanize }}</span></a> <a href="{{ ( printf "tags/%s/" ( . | urlize ) ) | relLangURL }}"><span itemprop="keyword">{{ . }}</span></a>
{{ end }} {{ end }}
</p> </p>
</div> </div>