{{- define "title" -}}
  {{- .Title }} - {{ T .Data.Singular | default .Data.Singular -}}
  {{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .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 "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
            </a>
            <span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
              {{- .Date | dateFormat ($.Site.Params.list.date_format | default "01-02") -}}
            </span>
          </article>
        {{- end -}}
      {{- end -}}
      {{- partial "base/paginator.html" . -}}
    {{- end -}}
  </div>
{{- end -}}
