feat(article): add support for custom taxonomy link
This commit is contained in:
parent
c74cc3e4b3
commit
b540350d76
@ -1,16 +1,19 @@
|
|||||||
{{ $image := partialCached "helper/image" (dict "Context" .) .RelPermalink }}
|
{{- $image := partialCached "helper/image" (dict "Context" .) .RelPermalink -}}
|
||||||
{{ $context := . }}
|
{{- $context := . -}}
|
||||||
|
{{- $categories := .Params.categories -}}
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
{{ with $categories := .Params.categories }}
|
{{ if $categories }}
|
||||||
<header class="article-category">
|
<header class="article-category">
|
||||||
{{ range $categories }}
|
{{ range $category := $categories }}
|
||||||
|
{{ with $.Site.GetPage (printf "/categories/%s" $category) }}
|
||||||
{{ if and $image.exists $image.resource }}
|
{{ if and $image.exists $image.resource }}
|
||||||
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
|
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
|
||||||
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
|
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
|
||||||
<a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}" class="color-tag"
|
<a href="{{ .Permalink }}" class="color-tag"
|
||||||
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ . | humanize }}</a>
|
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .Title | humanize }}</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
|
<a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ .Title | humanize }}</a>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</header>
|
</header>
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
<footer class="article-footer">
|
<footer class="article-footer">
|
||||||
{{ with $tags := .Params.Tags }}
|
{{ partial "article/components/tags" . }}
|
||||||
<section class="article-tags">
|
|
||||||
{{ range $tags }}
|
|
||||||
<a href="{{ printf `tags/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if and (.Site.Params.article.license.enabled) (not (eq .Params.license false)) }}
|
{{ if and (.Site.Params.article.license.enabled) (not (eq .Params.license false)) }}
|
||||||
<section class="article-copyright">
|
<section class="article-copyright">
|
||||||
|
10
layouts/partials/article/components/tags.html
Normal file
10
layouts/partials/article/components/tags.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{{- $tags := .Params.Tags -}}
|
||||||
|
{{ if $tags }}
|
||||||
|
<section class="article-tags">
|
||||||
|
{{ range $tag := $tags }}
|
||||||
|
{{ with $.Site.GetPage (printf "/tags/%s" $tag) }}
|
||||||
|
<a href="{{ .Permalink }}">{{ .Title | humanize }}</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user