{{- define "title" -}} {{ $name := .Name | lower }} {{ if ne ($name | i18n) "" }} {{ $name = $name | i18n }} {{ else }} {{ if ne .Section "events" }} {{ $name = $name | singularize }} {{ end }} {{ $name = $name | humanize }} {{ end }} {{ $name }} {{- end -}} {{- define "main" -}} {{ $s := .Site.Params }} {{- $paginator := slice -}} {{- $posts := where .Site.RegularPages "Type" "in" $s.mainSections }} {{ $meta := "false" }} {{- if eq .Section "events" -}} {{- $paginator = .Paginate (where site.RegularPages.ByDate.Reverse ".Params.when" "ne" nil) -}} {{- else if eq .Section "news" }} {{- $paginator = .Paginate (where (where .Site.RegularPages.ByDate.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.ByDate.Reverse -}} {{- end -}} {{ if eq $paginator.PageNumber 1 }} {{ if ne .Content "" }}
{{ .Content }}
{{ end }} {{ end }} {{- range first 5 $paginator.Pages -}}

{{- .Title -}}

{{ if and (ne .Params.when "") (ne .Params.when nil) }}
{{ .Params.when }}
{{ $meta = "true" }} {{ end }} {{ if and (ne .Params.price "") (ne .Params.price nil) }} {{ if eq .Params.price "free" }}
Der Eintritt ist frei.
{{ $meta = "true" }} {{ else }}
Eintritt: {{ .Params.price }}
{{ $meta = "true" }} {{ 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 "structure/sidebar" . }} {{ end }}