source: tanzpartie-hugo/themes/bilberry-hugo-theme/layouts/index.html @ 17240

Last change on this file since 17240 was 16971, checked in by Henrik Bettermann, 2 years ago
File size: 1.3 KB
Line 
1{{ define "main" }}
2{{ $allNonExcludedPages := where .Site.RegularPages "Params.excludefromindex" "==" nil }}
3{{ $allNonExcludedPagesNotTypePage := (where .Site.RegularPages "Type" "ne" "page" | intersect $allNonExcludedPages) }}
4
5{{ $pinnedPostRelPermalinks := split .Site.Params.pinnedPost "," }}
6{{ $pinnedPosts := where $allNonExcludedPagesNotTypePage "RelPermalink" "in" $pinnedPostRelPermalinks }}
7{{ $pagesToPaginate := where $allNonExcludedPagesNotTypePage "RelPermalink" "not in" $pinnedPostRelPermalinks }}
8
9{{ $paginationLimit := index .Site.Params "paginate" | default 7 }}
10{{ if not .Site.Params.pinOnlyToFirstPage }}
11    {{ $paginationLimit = sub $paginationLimit (len $pinnedPosts) }}
12{{ end }}
13
14{{ $paginator := .Paginate $pagesToPaginate $paginationLimit }}
15
16    {{ if .Site.Params.pinnedPost }}
17        {{ if (and .Site.Params.pinOnlyToFirstPage (ne $paginator.PageNumber 1)) }}
18            {{/* Do nothing if the pinOnlyToFirstPage flag is set and we're not on page 1. */}}
19        {{else}}
20            {{ range $pinnedPosts }}
21        {{ partial "article-wrapper.html" . }}
22            {{end}}
23        {{end}}
24    {{end}}
25
26    {{ range $paginator.Pages }}
27        {{ partial "article-wrapper.html" . }}
28    {{ end }}
29
30    {{ partial "paginator.html" . }}
31{{ end }}
Note: See TracBrowser for help on using the repository browser.