summaryrefslogtreecommitdiff
path: root/layouts/term.html
blob: fc0d9b43cde8ecf59c44d611a6f00a03dee0dc35 (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
46
47
48
49
50
51
{{ define "main" }}
    <article>
        {{ partial "header" . }}
        {{ partial "home/home-nav" . }}
        <div class="term-header">
            <h1 class="term-title"
                style="view-transition-name: category-{{ .Title }}">
                {{ with .Params.icon }}
                <span class="category-icon">{{ . }}</span>
                {{ end }}
                {{ if and (eq .Data.Singular "tag") (not .Params.icon) }}#{{ end }}{{ .Title }}
            </h1>
            {{ with .Params.description | markdownify }}
                <p class="term-description">{{ . }}</p>
            {{ end }}
        </div>
        <div>
            <!-- Posts under this Term -->
            <ul class="ps-0 flex flex-col gap-2 list-none leading-relaxed">
                {{ range where .Pages "Section" "not in" (slice "cards" "library") }}
                {{ partial "items/post-small" . }}
                {{ end }}
            </ul>

            <!-- Cards under this Term -->
            {{ $cards := where .Pages "Section" "eq" "cards" }}
            {{ if gt (len $cards) 0 }}
            <h2>{{ T "termPage.cards" }}</h2>
            <div class="outbox small">
                <div class="grid grid-cols-2 gap-4">
                    {{ range $cards }}
                    {{ partial "items/card" (dict "context" . "summary" true) }}
                    {{ end }}
                </div>
            </div>
            {{ end }}

            <!-- Books under this Term -->
            {{ $books := where .Pages "Section" "eq" "library" }}
            {{ if gt (len $books) 0 }}
            <h2>{{ T "termPage.books" }}</h2>
            <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
                {{ range $books }}
                {{ partial "items/book" . }}
                {{ end }}
            </div>
            {{ end }}
        </div>
    </article>
    {{ partial "footer.html" . }}
{{ end }}