Offset paginator "range after x posts" on home

:man_technologist: Hi! Im building a news site and at the end of the homepage I want to add a paginator. the problem I have is that when I use the paginator it shows the most recent posts which are the ones that are already showing up on the main section above.

My question is: Is there anyway to offset “x posts” the paginator list as I do with other elements? ex:
{{ range first 3 (after 5 (.Site.RegularPages.ByDate.Reverse)) }}

Here is the code of the posts section:

   <section class="flex mt-16">
  <div class="w-full lg:w-3/4 md:mt-0 flex flex-col items-start">

    {{ range .Paginator.Pages.ByDate.Reverse }} <!-- PROBABLY SOLUTION HERE-->

    <div class="flex flex-row items-center lg:items-start lg:flex-row-reverse mb-4 py-4 w-full border-b-2">

      <div class="ml-4 px-1 w-3/4 overflow-hidden md:mb-2 md:pl-2 lg:mb-2 lg:px-2">
        {{ if isset .Params "categories" }}
        <ul class="flex flex-wrap">
          {{ range .Params.categories }}
            <li class="text-blue-600 hover:underline helvetica font-bold text-sm uppercase mr-5 mb-3"><a href="{{ delimit (slice "/category/" (urlize .) $.Site.Params.ugly) "" | relURL }}"> {{ . }}</a></li>
          {{ end }}
        {{ end }}
        <a href="{{ .Permalink }}">
          <h2 class="font-medium text-lg md:text-xl hover:opacity-50">{{ .Title }}</h2>
        <p class="mt-4 text-gray-700">{{ .Summary }}</p>

      <a href="{{ .Permalink }}" class="w-1/4">
        <img class="object-fill hover:opacity-75 shadow-md" src="{{.Param "image"}}" alt="">

    {{ end }}

    {{ partial "pagination_home.html" .}}


Thanks for the help! :smiley:

You could collect the (shown + pagination) posts and then count inside of your range…

{{ range $index, $item := first 8 .Paginator.Pages.ByDate.Reverse }}
{{ if $index < 5 }}
... show the full post here, index starts at 0 ...
{{ else }}
... we are at item 6 to the end, so show the list of titles of these posts only ...
{{ end }}

Other than that, this here is the documentation for what you are asking for, but it sounds this does not work for you?

Thanks! I tried
{{ range (after 29 .Paginator.Pages.ByDate.Reverse) }}

And it worked for me

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.