{{- define "title" -}}
{{- $name := .Name -}}
{{- if lower $name | i18n -}}
{{- $name = lower $name | i18n -}}
{{- end -}}
{{- $name | humanize -}}
{{- end -}}
{{- define "main" -}}
{{- $paginator := slice -}}
{{- 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 -}}
{{- $paginator = .Paginate .RegularPagesRecursive.ByLastmod.Reverse -}}
{{- end -}}
{{- range first 5 $paginator.Pages -}}
{{ if and (isset .Params "categories") (eq .Section "events") }}{{ index .Params.categories 0 }}: {{ end }}{{- .Title -}}
{{ if .Params.when }}