{{/* Define section to pull recent posts from */}} {{ $mainSections := site.Params.mainSections | default (slice "post") }} {{/* First filter by section, then by year */}} {{ $filteredBySection := where site.RegularPages "Section" "in" $mainSections }} {{ $section := where $filteredBySection "Date.Year" 2024 }} {{ $section_count := len $section }} {{/* Use .Page to access page parameters */}} {{ $n_posts := .Page.Param "recent_posts_number" | default 3 }} {{ range (first $n_posts $section) }} {{ .Render "summary-with-image" }} {{ end }} {{ if ge $section_count (add $n_posts 1) }} {{ i18n "more" }} {{ range (first 4 (after $n_posts $section)) }} {{ .Title }} {{ end }} {{ end }}