{{ define "main" }}
{{ .Content }}
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
{{ $mainSections := site.Params.mainSections | compare.Default (collections.Slice "post") }}
{{ $show_recent_posts := site.Params.ananke.show_recent_posts }}
{{ $section := collections.Where $.Site.RegularPages "Section" "in" $mainSections }}
{{ $section_count := len $section }}
{{ if and ($show_recent_posts) (compare.Ge $section_count 1) }}
{{ $n_posts := $.Param "recent_posts_number" | compare.Default 3 }}
{{/* Range through the first $n_posts items of the section */}}
{{ range (collections.First $n_posts $section) }}
{{ .Render "summary-with-image" }}
{{ end }}
{{ if compare.Ge $section_count (math.Add $n_posts 1) }}
{{ lang.Translate "more" }}
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
{{ range (collections.First 4 (collections.After $n_posts $section)) }}