summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/taxonomy/term.html
blob: a96e107511d37ee29aa4c978c40f5dfc1879d88e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{{ define "main" }}
<div class="mx-auto px-4 py-12 max-w-5xl">
  <!-- Page title with taxonomy type -->
  <h1 class="text-4xl md:text-5xl font-bold text-accent mb-2">
    {{ i18n .Data.Singular }}
  </h1>

  <!-- Current term heading -->
  <p class="text-lg text-text-dim mb-12">
    <span class="inline-flex items-center px-3 py-1 rounded text-sm font-medium border border-accent/30 text-accent">
      {{ .Title }}
    </span>
  </p>

  {{ $pinned := where .Pages "Params.pinned" true }}
  {{ $unpinned := where .Pages "Params.pinned" false }}
  {{ if eq (len $unpinned) 0 }}
    {{ $unpinned = where .Pages "Params.pinned" nil }}
    {{ if eq (len $unpinned) 0 }}
      {{ $unpinned = where .Pages "Params.pinned" "" }}
    {{ end }}
  {{ end }}

  {{ if eq (len .Pages) 0 }}
  <div class="py-12 text-center text-text-dim">
    {{ i18n "noRelated" }}
  </div>
  {{ else }}
  <ol class="timeline" aria-label="{{ .Title }}">
    {{ range $i, $page := (sort $pinned "Date" "desc") }}
      {{ $side := "left" }}
      {{ if eq (mod $i 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }}
      {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }}
    {{ end }}
    {{ $offset := len $pinned }}
    {{ range $i, $page := (sort $unpinned "Date" "desc") }}
      {{ $idx := add $i $offset }}
      {{ $side := "left" }}
      {{ if eq (mod $idx 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }}
      {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }}
    {{ end }}
  </ol>
  {{ end }}
</div>
{{ end }}