website/layouts/index.html

30 lines
1.2 KiB
HTML
Raw Normal View History

2020-08-24 01:48:03 -05:00
{{ define "main" }}
{{/* get all the pages that are regular posts and not pages */}}
{{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }}
{{ $allPostsList := where .Site.RegularPages "Section" "in" $postsDir }}
{{ $featuredPostsList := slice }}
{{ $postsList := $allPostsList }}
2021-04-14 06:35:02 -05:00
{{ $pagination := slice }}
{{ if .Site.Params.enableFeatured | default false }}
{{ $featuredPostsList = where $allPostsList "Params.featured" true }}
{{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }}
2021-04-14 06:35:02 -05:00
{{ $pagination = (.Paginate $postsList).Pages }}
{{ if eq .Paginator.PageNumber 1 }}
{{- partial "featured_articles.html" $featuredPostsList -}}
{{ end }}
2021-04-14 06:35:02 -05:00
{{ else }}
{{ $pagination = (.Paginate $postsList).Pages }}
{{ end }}
2020-08-24 01:48:03 -05:00
{{/* pagination */}}
<div class="postlist {{ if .Site.Params.gridView }}gridView{{ end }}" id="postlist">
{{ range $pagination }}
{{- partial "article_card.html" . -}}
2020-08-24 01:48:03 -05:00
{{ end }}
</div>
<div id="getNextBtnContainer"></div>
{{- partial "paginator.html" . -}}
2020-08-24 01:48:03 -05:00
{{ end }}