Is it possible to have equal number of posts in first and subsequent pages?

It’s actually a bit simpler; no need to fill in the gaps.

layouts/posts/list.html
{{ define "main" }}
  <h1>{{ .Title }}</h1>
  {{ .Content }}

  {{/* Set constants. */}}
  {{ $numFeaturedPages := 2 }}
  {{ $numPagesFirstPager := 10 }}
  {{ $numPagesSubsequentPagers := 4 }}

  {{/* Paginate the page collection excluding the extra pages on the first pager. */}}
  {{ $paginator := .Paginate (.Pages | after (sub $numPagesFirstPager $numPagesSubsequentPagers)) $numPagesSubsequentPagers }}

  {{/* Featured pages. */}}
  {{ if eq $paginator.PageNumber 1  }}
    <pre>// BEGIN FEATURED</pre>
    {{ range first $numFeaturedPages .Pages }}
      <h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
    {{ end }}
    <pre>// END FEATURED</pre>
  {{ end }}

  {{/* Extra pages for the first pagter. */}}
  {{ if eq $paginator.PageNumber 1  }}
    <pre>// BEGIN EXTRA</pre>
    {{ range .Pages | after $numFeaturedPages | first (sub $numPagesFirstPager $numPagesSubsequentPagers $numFeaturedPages) }}
      <h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
    {{ end }}
    <pre>// END EXTRA</pre>
  {{ end }}

  {{/* The paginated page collection. */}}
  <pre>// BEGIN THE REST FOR THIS PAGER</pre>
  {{ range $paginator.Pages }}
    <h3><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h3>
  {{ end }}
  <pre>// END THE REST FOR THIS PAGER</pre>

  {{/* Navigation. */}}
  {{ template "_internal/pagination.html" . }}

{{ end }}

But the OP’s goal is still not entirely clear to me.

2 Likes