Fix tags and categories using GetTerms
See [documentation](https://gohugo.io/templates/taxonomy-templates/#display-a-single-piece-of-contents-taxonomies)
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
|
||||
{{- $context := . -}}
|
||||
{{- $categories := .Params.categories -}}
|
||||
<div class="article-details">
|
||||
{{ if $categories }}
|
||||
{{ if .Params.categories }}
|
||||
<header class="article-category">
|
||||
{{ range $category := $categories }}
|
||||
{{ $term := $.Site.GetPage (printf "/categories/%s" $category | urlize ) }}
|
||||
{{ range (.GetTerms "categories") }}
|
||||
{{ 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>
|
||||
<a href="{{ .Permalink }}" class="color-tag"
|
||||
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .LinkTitle | humanize }}</a>
|
||||
{{ else }}
|
||||
<a href="{{ $term.Permalink }}">{{ $term.Title | humanize }}</a>
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</header>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
{{- $tags := .Params.Tags -}}
|
||||
{{ if $tags }}
|
||||
{{ if .Params.Tags }}
|
||||
<section class="article-tags">
|
||||
{{ range $tag := $tags }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $tag) }}
|
||||
<a href="{{ .Permalink }}">{{ .Title | humanize }}</a>
|
||||
{{ end }}
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user