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:
{{ 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.