summaryrefslogtreecommitdiff
path: root/layouts/_default/list.html
blob: d3d2d9955ac87e826dab32eb6dd47028224af812 (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
{{- define "main" }}
<section class="list-page">
    <header class="list-page__header">
        <h1 class="list-page__headline">
            {{ .Title }}
        </h1>
        {{- with .Content }}
            <div class="list-page__description">
                {{ . }}
            </div>
        {{- else  }}
        {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }}
            <p class="list-page__description">
                {{ $description }}
            </p>
        {{- end }}
    </header>

    <section class="list-page__content" aria-label="{{ lang.Translate "posts.name" | default "Posts" }}">
        {{- /* 20 posts per site */ -}}
        {{- $paginator := .Paginate .Pages 20 }}
        {{- with $paginator.Pages }}
            <ul class="list-page__posts-list">
                {{- range . }}
                    <li class="list-page__post">
                        {{- partial "list/post-card.html" . }}
                    </li>
                {{- end }}
            </ul>
        {{ else }}
            <p class="list-page__empty-message">
                {{ lang.Translate "list.empty" | default "No posts found in this section." }}
            </p>
        {{- end }}
    </section>

    {{- partial "list/pagination.html" $paginator }}
</section>
{{- end }}