Update post_tags partial

* Simplify tags existense check
* Update tags partial in line with the Hugo Docs
This commit is contained in:
vimux 2019-11-12 09:45:51 -05:00
parent f184b72d8d
commit 077ae0345e
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34

View file

@ -1,8 +1,11 @@
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
{{- $taxo := "tags" -}}
{{- with .Param $taxo }}
<div class="post__tags">
{{ range $k, $v := $.Params.tags }}<a class="post__tag btn" href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }}
{{- range . }}
{{- $name := . -}}
{{- with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }}
<a class="post__tag btn" href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end }}
{{- end }}
</div>
{{ end }}
{{ end }}
{{- end }}