Files
FixIt/layouts/taxonomy.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

21 lines
977 B
HTML

{{- define "title" -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $taxonomies := .Data.Plural -}}
{{- $icon := .Params.titleIcon | default (dict "Taxonomy" .Data.Singular "Slot" "title" | partial "function/get-taxonomy-icon.html") -}}
<div class="page archive">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">
{{- dict "Class" (add $icon " me-1") | partial "plugin/icon.html" -}}
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" }} <sup>{{ len .Data.Terms.ByCount }}</sup>
</h1>
{{- /* Render different taxonomies */ -}}
{{- $template := cond ( eq $taxonomies "tags") "tags" "taxonomies" -}}
{{- .Render $template -}}
</div>
{{- end -}}