blogamore/layouts/blog/list.html

63 lines
2.6 KiB
HTML
Raw Permalink Normal View History

2022-11-13 20:52:45 +01:00
{{ define "head" }}
{{ if eq .Type "blog" }}
{{ $latestEntry := index (where (where .Site.RegularPages "Type" "blog") "Params.featured" true).ByPublishDate.Reverse 0 }}
2022-11-28 19:45:15 +01:00
{{ with $latestEntry }}
2022-11-20 15:04:48 +01:00
<div class="p-4 m-2 rounded text-bg-dark">
2022-11-13 20:52:45 +01:00
<div class="col-md6 px-0">
2022-11-28 19:45:15 +01:00
<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>
2022-11-13 20:52:45 +01:00
</div>
</div>
2022-11-28 19:45:15 +01:00
{{ end }}
2022-11-13 20:52:45 +01:00
{{ 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*/}}
2022-11-15 23:34:16 +01:00
{{ $pag := .Paginate (where .Site.RegularPages "Type" "blog").ByPublishDate.Reverse }}
2022-11-13 20:52:45 +01:00
{{ else }}
2022-11-28 19:45:15 +01:00
{{/* Der 2te Weg ist über die Archive-Gruppierung */}}
{{ $pag := .Paginate .Pages.ByPublishDate.Reverse }}
2022-11-13 20:52:45 +01:00
{{ 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>
2022-11-28 22:36:47 +01:00
<p class="blog-post-meta">{{ partial "meta/data.html" . }}</p>
2022-11-13 20:52:45 +01:00
<p>{{ .Summary }}</p>
</article>
{{ end }}
{{ template "partials/pagination.html" . }}
{{ end }}
{{ define "sidebar" }}
2022-11-28 19:45:15 +01:00
<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 }}
2022-11-13 20:52:45 +01:00
{{ $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 }}
2022-11-13 20:52:45 +01:00
{{- 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 }}
2022-11-13 20:52:45 +01:00
</div>
</div>
{{ end }}