Files
FixIt/layouts/taxonomies.html
T
Cell 1e0d1affaf feat(taxonomy): support taxonomy_icons with shared icon resolver and front matter icon overrides (#732)
- Added new config section: `params.taxonomy_icons`
  - Syntax: `<taxonomy> = [<title icon>, <card icon>, <term title icon>]`
- Added a shared resolver partial to centralize taxonomy icon lookup.
- Updated taxonomy-related templates to use the shared resolver instead of hardcoded icon maps.
- Added front matter overrides for taxonomy pages:
  - `titleIcon`
  - `cardIcon` (only for taxonomy `_index.md`)

Icon resolving priority now is:

1. Front matter override (`titleIcon` / `cardIcon`)
2. `params.taxonomy_icons` custom config
3. Built-in defaults (`tag`, `category`, `collection`)
2026-04-14 17:23:05 +08:00

39 lines
1.5 KiB
HTML

{{- /* Taxonomies Page */ -}}
{{- $icon := .Params.cardIcon | default (dict "Taxonomy" .Data.Singular "Slot" "card" | partial "function/get-taxonomy-icon.html") -}}
<div class="taxonomy-cards {{ .Data.Plural }}">
{{- range .Data.Terms.ByCount -}}
{{- $term := .Term -}}
{{- $pages := .Pages -}}
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $.Type $term) -}}
<div class="card-item">
<div class="card-item-wrapper">
<h2 class="card-item-title">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
{{- dict "Class" (add $icon " me-1") | partial "plugin/icon.html" -}}
{{- .Page.Title }} <sup>{{ len $pages }}</sup>
</a>
</h2>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- $repost := .Params.repost | default dict -}}
{{- if eq $repost.enable true -}}
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}}
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
<div class="more-post">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="more-single-link">{{ T "pagination.more" }} >></a>
</div>
{{- end -}}
</div>
</div>
{{- end -}}
{{- end -}}
</div>
{{- /* EOF */ -}}