# Issues with .Paginate

**URL:** https://discourse.gohugo.io/t/issues-with-paginate/53545
**Category:** support
**Tags:** pagination
**Created:** [February 15, 2025, 7:37pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545 "2025-02-15T19:37:01Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)
#### Post date: [February 15, 2025, 7:37pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/1 "2025-02-15T19:37:01Z")

</div>

Hey guys I’m running into an issue when using .Paginate. I’m trying to create a collection of pages by making a union of two sections and then applying pagination to it.

It’s very weird since the collection of both sections works just fine it’s when I try to paginate them that .Paginate seems to just use the current sections pages instead of using the collection I provide it with.

Here is my code:

```auto
{{ define "main" }}
{{/* Get all pages from press-release and news sections */}}
      {{ $pressReleases := where site.RegularPages.ByDate.Reverse "Section" "press-release" }}
      {{ $news := .RegularPagesRecursive.ByDate.Reverse }}

      {{/* Combine and sort pages */}}
      {{ $pages := sort (union $news $pressReleases) ".Date" "desc" }}

      {{/* Paginate the sorted pages */}}
      {{ $paginator := .Paginate $pages.ByDate.Reverse }}

      <h1>Press Releases - Pages({{len $pressReleases}})</h1>
      {{range $pressReleases}}
      <p>{{ .Title }}</p>
      {{ end }}

      <h1>News - Pages({{len $news}})</h1>
      {{range $news}}
      <p>{{ .Title }}</p>
      {{ end }}
      
      <h1>Paginator Pages - {{$paginator.Pages}}</h1>
      {{range $paginator.Pages}}
      <p>{{ .Title }}</p>
      {{ end }}

      <h1>Merged Pages - {{$pages}}</h1>
      {{ range $pages }}
        <p>{{ .Title }}</p>
      {{ end }}

      <p> Total merged pages: {{ len $pages }} </p>
      <p> Pages in current pagination: {{ len $paginator.Pages }} </p>
{{ end }}

```

And here is the output for debugging purposes:

* * *

### Press Releases - Pages(15)

Rewst Unveils Details and Registration for FLOW 2025, the Vendor-Agnostic Automation Conference for MSPs

Rewst Empowers MSPs to Monetize Automation with First in a Series of Client-Facing Integrations

Rewst Unveils First Three Prebuilt Apps for App Builder

Rewst Raises $45 Million to Accelerate Platform Innovation and Community-Led Growth

Synnex Australia and Rewst Forge Strategic Partnership to Elevate MSP Automation

Rewst Extends Open, Vendor-Agnostic Vision with Expanded Integration Library and Custom Integration Builder

Introducing FLOW, a vendor-agnostic automation conference for MSPs, hosted by Rewst

Rewst Raises $31 Million Series B to Extend Leadership in MSP Automation Market

Rewst Unveils Low-Code App Platform, Enabling MSPs to Extend Automations with Branded Front-End Experiences

Rewst releases 50 pre-built automations, helping MSPs realize immediate business value

Pax8 and Rewst Partner to Provide MSPs with Purpose-Built Robotic Process Automation Platform

Meet the ROC: Tim Fournet, Cratemaster

Rewst Raises $21.5 Million Series A to Bring Automation to MSPs

Rewst Secures $4 Million Funding Led by TDF Ventures

Florida Funders Leads $2.5MM Seed Investment in Rewst

### News - Pages(5)

Rewst CEO, Aharon Chernin, Named Tampa Bay Inno Fire Awards Honoree

Tampa serial entrepreneur raises $4M

MSP Automation Software Startup Rewst Raises $4M; Plans RPA Expansion

New Venture ‘Rewst’ Aims to Make Automation More Accessible for MSPs

Startup Rewst Closes $2.5M Seed Funding To Bring RPA To MSPs

### Paginator Pages - Pages(5)

Rewst CEO, Aharon Chernin, Named Tampa Bay Inno Fire Awards Honoree

Tampa serial entrepreneur raises $4M

MSP Automation Software Startup Rewst Raises $4M; Plans RPA Expansion

New Venture ‘Rewst’ Aims to Make Automation More Accessible for MSPs

Startup Rewst Closes $2.5M Seed Funding To Bring RPA To MSPs

### Merged Pages - Pages(20)

Rewst Unveils Details and Registration for FLOW 2025, the Vendor-Agnostic Automation Conference for MSPs

Rewst Empowers MSPs to Monetize Automation with First in a Series of Client-Facing Integrations

Rewst Unveils First Three Prebuilt Apps for App Builder

Rewst Raises $45 Million to Accelerate Platform Innovation and Community-Led Growth

Synnex Australia and Rewst Forge Strategic Partnership to Elevate MSP Automation

Rewst Extends Open, Vendor-Agnostic Vision with Expanded Integration Library and Custom Integration Builder

Introducing FLOW, a vendor-agnostic automation conference for MSPs, hosted by Rewst

Rewst Raises $31 Million Series B to Extend Leadership in MSP Automation Market

Rewst Unveils Low-Code App Platform, Enabling MSPs to Extend Automations with Branded Front-End Experiences

Rewst releases 50 pre-built automations, helping MSPs realize immediate business value

Pax8 and Rewst Partner to Provide MSPs with Purpose-Built Robotic Process Automation Platform

Meet the ROC: Tim Fournet, Cratemaster

Rewst Raises $21.5 Million Series A to Bring Automation to MSPs

Rewst CEO, Aharon Chernin, Named Tampa Bay Inno Fire Awards Honoree

Tampa serial entrepreneur raises $4M

Rewst Secures $4 Million Funding Led by TDF Ventures

MSP Automation Software Startup Rewst Raises $4M; Plans RPA Expansion

New Venture ‘Rewst’ Aims to Make Automation More Accessible for MSPs

Startup Rewst Closes $2.5M Seed Funding To Bring RPA To MSPs

Florida Funders Leads $2.5MM Seed Investment in Rewst

### Total merged pages: 20

### Pages in current pagination: 5

* * *

Any clues as to what I am doing wrong? Thanks.

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [February 15, 2025, 7:41pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/2 "2025-02-15T19:41:54Z")

</div>

[https://gohugo.io/templates/pagination/](https://gohugo.io/templates/pagination/)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/d/1d104beae5738c1f52dc5d95947d092b0a3dd58d.png)

So I suspect you are first invoking one or the other somewhere else.

---

<div class="post-metadata">

### Author: ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)
#### Post date: [February 15, 2025, 7:47pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/3 "2025-02-15T19:47:57Z")

</div>

Thats literally the whole code of the list page template, I’m not calling pagination on it anywhere else 😬

Hugo version in case that helps:

`hugo v0.143.1+extended+withdeploy darwin/arm64 BuildDate=2025-02-04T08:57:38Z VendorInfo=brew`

This was working in Hugo v0.120 or lower IIRC

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [February 15, 2025, 7:53pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/4 "2025-02-15T19:53:36Z")

</div>

Can you share your repo?

---

<div class="post-metadata">

### Author: ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)
#### Post date: [February 15, 2025, 9:18pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/5 "2025-02-15T21:18:09Z")

</div>

I cannot but I’ll make a repo where I can replicate the issue, thanks @jmooring

---

<div class="post-metadata">

### Author: ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)
#### Post date: [February 15, 2025, 9:44pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/6 "2025-02-15T21:44:45Z")

</div>

I stand corrected, you were right. We are using this in our head in order to have unique title tags for paginated pages:

```auto
{{ if .IsNode }}
  {{ if .Paginator }}
    {{ $pageNumber = printf " - Page %d" .Paginator.PageNumber }}
  {{ end }}
{{ end }}

```

If I get rid of it it works FML, now to see how to solve this conundrum.

Thanks for pointing me in the right direction (as usual) @jmooring you are the Hugo GOAT 🏆

---

<div class="post-metadata">

### Author: ![tyco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tyco/32/23754_2.png) [@tyco](https://discourse.gohugo.io/u/tyco)
#### Post date: [February 16, 2025, 4:47am UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/7 "2025-02-16T04:47:05Z")

</div>

> [@benmarte](#):
>
> now to see how to solve this conundrum.

> [@Pagination: using pager values within the head element](https://discourse.gohugo.io/t/pagination-using-pager-values-within-the-head-element/50340):
>
> Objective Render something like this, from a base template, for each pager of a paginated collection: \<head\> ... \<title\>Books - Page 3 | My Site\</title\> \<link rel="canonical" href="http://localhost:1313/en/books/page/3/"\> \<link rel="prev" href="http://localhost:1313/en/books/page/2/"\> \<link rel="next" href="http://localhost:1313/en/books/page/4/"\> \<link rel="alternate" hreflang="x-default" href="http://localhost:1313/en/books/page/3/"\> \<link rel="alternate" hreflang="en" href="htt…

---

<div class="post-metadata">

### Author: ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)
#### Post date: [February 16, 2025, 1:36pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/8 "2025-02-16T13:36:20Z")

</div>

Thanks @tyco again @jmooring showing us how its done 💪

Thanks guys

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [February 18, 2025, 1:36pm UTC](https://discourse.gohugo.io/t/issues-with-paginate/53545/9 "2025-02-18T13:36:54Z")

</div>

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