bunteshaus.de/themes/buha/layouts/index.html
2022-04-08 14:12:20 +02:00

40 lines
1.4 KiB
HTML

{{ define "title" }}
{{ if .Content }}
<h1>{{ .Title }}</h1>
{{ end }}
{{ end }}
{{ define "main" }}
{{ $s := .Site.Params }}
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.searchSections }}
{{- $featured := where (where $posts ".Params.featured" "=" true) "Type" "in" $s.searchSections }}
{{ $featured = where $featured ".Params.Lastmod" "gt" (now.AddDate 0 0 -14) }}
{{- $paginator := .Paginate $posts -}}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
<article>
{{ .Content }}
</article>
{{ end }}
{{ if gt (len $featured) 0 }}
<a href="/featured"><h2>{{if "featured" | i18n }}{{ "featured" | i18n }}{{ else }}{{ "Featured" }}{{ end }}</h2></a>
{{ partial "contentlayouts/list.html" (dict "context" . "pages" $featured "amount" "3" "max_age" "14" "featured" "true") }}
{{ end }}
{{ end }}
{{ if gt (len $posts) 1 }}
<a href="/news"><h2>{{ if "news" | i18n }}{{ "news" | i18n }}{{ else }}{{ "News" }}{{ end }}</h2></a>
{{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5" "max_age" "-14") }}
<div id="pagination_outer" style="display: flex; justify-content: center;">
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
</div>
{{ end }}
{{ end }}
{{ define "sidebar" }}
{{- partial "contentlayouts/menu.html" . }}
{{ end }}