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" }} {{- $taxo := "tags" -}}
{{ $tagsLen := len $.Params.tags }} {{- with .Param $taxo }}
{{ if gt $tagsLen 0 }}
<div class="post__tags"> <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> </div>
{{ end }} {{- end }}
{{ end }}