Implemented category badges in secondary color.

This commit is contained in:
MaikelChan
2026-03-23 05:45:46 +01:00
parent cc94a0e6c8
commit e84fc0e1c6
4 changed files with 60 additions and 19 deletions
+19 -18
View File
@@ -98,28 +98,29 @@
{{ 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 and (not (eq $taxonomy "authors")) (not (eq $taxonomy "series")) }}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
<a class="relative mt-[0.5rem] me-2" href="{{ .RelPermalink }}">
{{ partial "badge.html" .LinkTitle }}
</a>
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
{{ if .Params.showCategories | default (.Site.Params.article.showCategories | default true) }}
{{ if (eq $taxonomy "categories") }}
<a class="relative mt-[0.5rem] me-2" href="{{ .RelPermalink }}">
{{ if .Params.showCategoriesInSecondaryColor | default (.Site.Params.article.showCategoriesInSecondaryColor | default false) }}
{{ partial "badge-secondary.html" .LinkTitle }}
{{ else }}
{{ partial "badge.html" .LinkTitle }}
{{ end }}
</a>
{{ end }}
{{ end }}
{{ if .Params.showTags | default (.Site.Params.article.showTags | default true) }}
{{ if (eq $taxonomy "tags") }}
<a class="relative mt-[0.5rem] me-2" href="{{ .RelPermalink }}">
{{ partial "badge.html" .LinkTitle }}
</a>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{/* Output only category */}}
{{ if .Params.showCategoryOnly | default (.Site.Params.article.showCategoryOnly | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range (.GetTerms "categories") }}
<a class="relative mt-[0.5rem] me-2" href="{{ .RelPermalink }}">
{{ partial "badge.html" .LinkTitle }}
</a>
{{ end }}
</div>
{{ end }}
{{ end }}
+6
View File
@@ -0,0 +1,6 @@
<span class="flex cursor-pointer">
<span
class="rounded-md border border-secondary-400 px-1 py-[1px] text-xs font-normal text-secondary-700 dark:border-secondary-600 dark:text-secondary-400">
{{ . }}
</span>
</span>