{{ define "main" }}
{{ .Content }}
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }} {{ $section := where .Site.RegularPages "Section" "in" $mainSections }} {{ $section_count := len $section }} {{ if ge $section_count 1 }} {{ $section_name := index (.Site.Params.mainSections) 0 }}
{{ with .Site.GetPage "section" $section_name }}

{{ $.Param "recent_copy" | default (i18n "recentTitle" .) }}

{{ end }} {{ $n_posts := $.Param "recent_posts_number" | default 10 }}
{{ range (first $n_posts $section) }}
{{ partial "item.html" . }}
{{ end }}
{{ if ge $section_count (add $n_posts 1) }}
{{ with .Site.GetPage "section" $section_name }} {{ i18n "allTitle" . }} {{ end }}
{{ end }}
{{ end }} {{ end }}