fixed badges for taxonomies

This commit is contained in:
Nuno Coração 2022-10-02 01:03:22 +01:00
parent e3a83eadc0
commit 73646562be
2 changed files with 63 additions and 57 deletions

View file

@ -16,7 +16,8 @@
{{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }}
{{ end }} {{ end }}
{{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial "functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} {{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial
"functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }}
{{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} {{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }}
{{ end }} {{ end }}
@ -24,7 +25,8 @@
{{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }}
{{ end }} {{ end }}
{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }} {{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0)
}}
{{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} {{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }}
{{ end }} {{ end }}
@ -56,20 +58,24 @@
<span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span> <span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span>
{{ end }} {{ end }}
{{/* Output taxonomies */}}
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }}
{{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
<span class="pl-2" onclick="window.open({{ .RelPermalink }});">
{{ partial "badge.html" .LinkTitle }}
</span>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{ end }}
</div> </div>
{{/* Output taxonomies */}}
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
<span style="margin-top:0.5rem" class="mr-2" onclick="window.open({{ .RelPermalink }});">
{{ partial "badge.html" .LinkTitle }}
</span>
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}

View file

@ -1,6 +1,6 @@
<span class="flex"> <span class="flex">
<span <span
class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 ltr:ml-1 rtl:mr-1 dark:border-primary-600 dark:text-primary-400" class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400"
> >
{{ . }} {{ . }}
</span> </span>