added extra content option for more home page like post views

This commit is contained in:
Gabriele Musco 2021-06-12 15:07:39 +02:00
parent 79bc934c75
commit 18a213cf31
No known key found for this signature in database
GPG key ID: 8539FD3454380B83
6 changed files with 50 additions and 36 deletions

View file

@ -0,0 +1,23 @@
{{ $allPostsList := .AllPostsList }}
{{ $postsList := $allPostsList }}
{{ $featuredPostsList := slice }}
{{ $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) }}
{{ $pagination = (.Ctx.Paginate $postsList).Pages }}
{{ if eq .Ctx.Paginator.PageNumber 1 }}
{{- partial "featured_articles.html" $featuredPostsList -}}
{{ end }}
{{ else }}
{{ $pagination = (.Ctx.Paginate $postsList).Pages }}
{{ end }}
{{/* pagination */}}
<div class="postlist {{ if site.Params.gridView }}gridView{{ end }}" id="postlist">
{{ range $pagination }}
{{- partial "article_card.html" . -}}
{{ end }}
</div>
<div id="getNextBtnContainer"></div>
{{- partial "paginator.html" .Ctx -}}