{{- define "title" -}} {{- $name := .Name | lower -}} {{ if ne .Section "events" }} {{ $name = $name | singularize }} {{ end }} {{ if ne ($name | i18n) "" }} {{ $name = $name | i18n }} {{ end }} {{ $name = $name | humanize }} {{ $name }} {{- end -}} {{- define "main" -}} {{ $s := .Site.Params }} {{ if ne .Content "" }}
{{ .Content }}
{{ end }} {{- $paginator := slice -}} {{- $posts := where .Site.RegularPages "Type" "in" $s.mainSections }} {{- if eq .Section "events" -}} {{- $paginator = .Paginate (where site.RegularPages.ByLastmod.Reverse ".Params.when" "ne" nil) -}} {{- else if eq .Section "news" }} {{- $paginator = .Paginate (where (where .Site.RegularPages.ByLastmod.Reverse "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.mainSections) }} {{- else if eq .Section "featured" }} {{- $paginator = .Paginate (where $posts "Params.featured" true) -}} {{- else if eq .Section "recurrent" }} {{- $paginator = .Paginate (where .Site.RegularPages "Params.recurrent" true) -}} {{- else -}} {{- $paginator = .Paginate .RegularPagesRecursive.ByLastmod.Reverse -}} {{- end -}} {{- range first 5 $paginator.Pages -}}

{{- .Title -}}

{{ if and (ne .Params.when "") (ne .Params.when nil) }}
{{ .Params.when }}
{{ end }} {{ if and (ne .Params.price "") (ne .Params.price nil) }} {{ if eq .Params.price "free" }}
Der Eintritt ist frei.
{{ else }}
Eintritt: {{ .Params.price }}
{{ end }} {{ end }}
{{- if .Resources.ByType "image" -}} {{- $pic := index (.Resources.ByType "image") 0 -}} {{ $thumb := "" }} {{ if eq .Content "" }}
{{- $thumb = $pic.Resize "1024x" }} {{ else }}
{{- $thumb = $pic.Resize "2048x" }} {{ end }}
{{- end }}
{{- if .Params.description -}} {{- .Params.description -}} {{- else -}} {{- .Summary -}} {{- end }} {{ if .Truncated }}
{{- i18n "readmore" -}}..
{{ end }}
{{- end }} {{- end -}} {{ define "sidebar" }} {{- partial "sidebar" . }} {{ end }}