summaryrefslogtreecommitdiff
path: root/layouts/_default/list.html
blob: 8ff9b185b6076577758f7f2d9e8f7bf1ca0a4065 (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
{{- define "main" }}
<section class="section-list">
    <header class="section-list__header">
        <h1 class="section-list__headline">
            {{ .Title }}
        </h1>
        {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }}
        <p class="section-list__description">
            {{ $description }}
        </p>
    </header>

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

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