{{- define "title" -}}
  {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}

{{- define "content" -}}
  <div class="page archive">
    {{- /* Title */ -}}
    <h2 class="single-title animate__animated animate__pulse animate__faster">
      {{- $taxonomy := .Data.Singular -}}
      {{- $pageCount := len .Pages -}}
      {{- if eq $taxonomy "category" -}}
        {{ dict "Class" "fa-regular fa-folder-open fa-fw" | partial "plugin/icon.html" }}
        {{ .Title }}&nbsp;<sup>{{- $pageCount -}}</sup>
      {{- else if eq $taxonomy "tag" -}}
        {{ dict "Class" "fa-solid fa-tag fa-fw" | partial "plugin/icon.html" }}
        {{ .Title }}&nbsp;<sup>{{- $pageCount -}}</sup>
      {{- else -}}
        {{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
      {{- end -}}
    </h2>

    {{- /* Paginate */ -}}
    {{- if .Pages -}}
      {{- $pages := .Pages.GroupByDate "2006" -}}
      {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
        {{- $pages = $.Paginate $pages . -}}
      {{- else -}}
        {{- $pages = .Paginate $pages -}}
      {{- end -}}
      {{- range $pages.PageGroups -}}
        <h3 class="group-title">{{ .Key }}</h3>
        {{- range .Pages -}}
          <article class="archive-item">
            <a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
            <span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
              {{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
            </span>
          </article>
        {{- end -}}
      {{- end -}}
      {{- partial "paginator.html" . -}}
    {{- end -}}
  </div>
{{- end -}}
