How to allow dynamic number of items based on number of pages in pageGroups?

Hi Hugo Community,

I want to create a website for journalling purpose. Each page will be a separate note in journal with date, time, and some text or picture.
I want to create a list page where I will have list of “entries” for journal, but because it may go up to a lot of pages, paginating is required.

The desired outcome would be a yearly archive.
Paginated pages would be grouped by date, and each list page would have one year. So let’s say:
2022 as current page 0, would have llinks to 350 pages
2021 as page 1, would have links to 294 pages
etc, etc.

Right now, I’ve managed to get the posts grouped by date using this:

{{$pages := .Pages.GroupByDate "2006" }}

and I can see it using this


Result: [Pages(12) Pages(5)]

I’ve tried many options to get that to work but I always end up with maximum 10 entries per page and first element has 12 items that spill to page 2.
In result on page 2 I have 2 entries from 2022 and 5 from 2021.

Am I missing something or this is not possible with pagination?


You are correct.