fix(article/details): fix custom taxonomy link

This commit is contained in:
Jimmy Cai 2020-09-18 20:05:19 +02:00
parent b2a1afd744
commit 117dd4b81e
No known key found for this signature in database
GPG key ID: 3EA408E527F37B18

View file

@ -5,15 +5,14 @@
{{ if $categories }}
<header class="article-category">
{{ range $category := $categories }}
{{ with $.Site.GetPage (printf "/categories/%s" $category) }}
{{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="{{ .Permalink }}" class="color-tag"
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .Title | humanize }}</a>
{{ else }}
<a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ .Title | humanize }}</a>
{{ end }}
{{ $term := $.Site.GetPage (printf "/categories/%s" $category) }}
{{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="{{ $term.Permalink }}" class="color-tag"
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ $term.Title | humanize }}</a>
{{ else }}
<a href="{{ $term.Permalink }}">{{ $term.Title | humanize }}</a>
{{ end }}
{{ end }}
</header>