{{ define "head" }} {{ if eq .Type "blog" }} {{ $latestEntry := index (where (where .Site.RegularPages "Type" "blog") "Params.featured" true).ByPublishDate.Reverse 0 }} {{ with $latestEntry }} <div class="p-4 m-2 rounded text-bg-dark"> <div class="col-md6 px-0"> <h1 class="display-4 fst-italic">{{ .Title }}</h1> <p class="lead my-3">{{ .Summary | safeHTML }}</p> <p class="lead mb-0"><a href="{{ .RelPermalink }}" class="text-white fw-bold">Weiter lesen...</a></p> </div> </div> {{ end }} {{ end }} {{ end }} {{ define "main" }} {{/* Paginator initialisieren, in der Reihenfolge die man sich im Blog wünscht */}} {{ if eq .Type "blog" }} {{/* Der 1te Weg soll alle Blog-Einträge finden*/}} {{ $pag := .Paginate (where .Site.RegularPages "Type" "blog").ByPublishDate.Reverse }} {{ else }} {{/* Der 2te Weg ist über die Archive-Gruppierung */}} {{ $pag := .Paginate .Pages.ByPublishDate.Reverse }} {{ end }} {{/* Der Paginator wurde in den If-Blöcken zwar erstellt, aber die Variable ist auserhalb nicht sichtbar, daher hier explizit holen. Dieser kann nach dem ersten erstellen auch nicht mehr verändert werden */}} {{ $pag := .Paginator }} {{ range $pag.Pages }} <article class="blog-post"> <h3 class="blog-post-title_ mb-1"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3> <p class="blog-post-meta">{{ partial "metadata.html" . }}</p> <p>{{ .Summary }}</p> </article> {{ end }} {{ template "partials/pagination.html" . }} {{ end }} {{ define "sidebar" }} <div class="position-sticky"> {{ $catIdent := .Site.Params.Blog.Categories | default "categories" }} {{ $cats := (index $.Site.Taxonomies $catIdent)}} {{ if $cats }} {{- partial "widget/header.html" (dict "title" "Kategorien") -}} {{- partial "widget/taglist.html" (dict "ident" $catIdent "tax" $cats) -}} {{ end }} {{ $tagsIdent := .Site.Params.Blog.Tags | default "tags" }} {{ $tags := (index $.Site.Taxonomies $tagsIdent)}} {{ if $tags }} {{- partial "widget/header.html" (dict "title" "Schlagwortwolke") -}} {{- partial "widget/cloud.html" (dict "ident" $tagsIdent "tax" $tags) -}} {{ end }} {{- partial "widget/header.html" (dict "title" "Archive") -}} <div class="mb-2 list-group"> {{/* Hier explizit auf Type achten!! */}} {{ range (where .Site.RegularPages "Type" "blog").GroupByDate "2006" }} <a class="list-group-item list-group-item-action" href="/blog/{{ .Key }}">Jahr {{ .Key }}</a> {{ end }} </div> </div> {{ end }}