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

53 lines
2.1 KiB
HTML

{{- define "title" -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
<div class="page archive">
{{- /* Title */ -}}
{{- $taxonomy := .Data.Singular -}}
{{- $pageCount := len .Pages -}}
{{- $termIcon := .Params.titleIcon | default (dict "Taxonomy" $taxonomy "Slot" "term" | partial "function/get-taxonomy-icon.html") -}}
{{- $termTitle := .Title -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">
{{- with $termIcon -}}
{{- dict "Class" (add . " me-1") | partial "plugin/icon.html" -}}
{{- end -}}
{{- $termTitle }} <sup>{{ $pageCount }}</sup>
</h1>
{{- /* Paginate */ -}}
{{- if .Pages -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- partial "section/recently-updated.html" . -}}
{{- range $pages.PageGroups -}}
<h2 class="group-title">
{{- dict "Class" "fa-regular fa-calendar me-1" | partial "plugin/icon.html" -}}
{{- .Key -}}
</h2>
{{- range .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>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.list.dateFormat | default "01-02") -}}
</span>
</article>
{{- end -}}
{{- end -}}
{{- partial "layout/paginator.html" . -}}
{{- end -}}
</div>
{{- end -}}