I have a list page where I’m showing the latest 3 pages using one template and the rest of them using another. The older pages need to be paginated so I can insert row classes…
This is working, but I was just wondering if there is a better way?
<!-- Latest Posts -->
{{ range first 3 (where .Data.Pages.ByDate.Reverse "Section" "posts") }}
{{ .Render "featured" }}
{{ end }}
<!-- Older posts -->
{{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Section" "posts") 3 }}
{{ if ge $paginator.Pagers 2 }}
{{ range after 1 $paginator.Pagers }}
<div class="row">
{{ range .Pages }}
{{ .Render "summary" }}
{{ end }}
</div>
{{ end }}
{{ end }}