added optional showcase section to home page

This commit is contained in:
Gabriele Musco 2021-07-06 20:19:13 +02:00
parent 38a8b48e8c
commit 3176229a6b
No known key found for this signature in database
GPG key ID: 8539FD3454380B83
4 changed files with 44 additions and 0 deletions

View file

@ -3,6 +3,7 @@
{{/* 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 }}
{{- partial "showcase.html" . -}}
{{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}}
{{ end }}

View file

@ -0,0 +1,17 @@
{{ if .Site.Params.showcaseDir }}
{{ $showcasePosts := where site.RegularPages "Section" "in" .Site.Params.showcaseDir }}
{{ range (sort $showcasePosts "File.LogicalName") }}
{{ if in .Dir .Site.Params.showcaseDir }}
<div class="showcaseCard {{if .Site.Params.discreteCards }}discrete{{ end }}">
<div>
<h1>{{ .Title }}</h1>
<div>{{ .Content }}</div>
</div>
{{ if .Params.image }}
<img src="{{ .Params.image }}" />
{{ end }}
</div>
{{ end }}
{{ end }}
<hr />
{{ end }}