{{ $allPostsList := .AllPostsList }} {{ $postsList := $allPostsList }} {{ $featuredPostsList := slice }} {{ $pagination := slice }} {{ if site.Params.enableFeatured | default false }} {{ $featuredPostsList = where $allPostsList "Params.featured" true }} {{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }} {{ $pagination = (.Ctx.Paginate $postsList).Pages }} {{ if eq .Ctx.Paginator.PageNumber 1 }} {{- partial "featured_articles.html" $featuredPostsList -}} {{ end }} {{ else }} {{ $pagination = (.Ctx.Paginate $postsList).Pages }} {{ end }} {{/* pagination */}}