What does .PageGroups do?


I can’t seem to find much information on what .PageGroups does.

{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups  }}

Via: Pagination | Hugo

Could someone explain what the above code does? Why would I need .PageGroups?



Thanks! Sorry for my late reply, for some reason I didn’t get an email that someone replied.

The page you link to does not have a reference to PageGroups.

Maybe a better question would be, how does PageGroups affect pagination? I think the example I originally posted groups by year:

{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups  }}

Extrapolating, I’m assuming you can do:

{{ range (.Paginate (.Pages.GroupByParam "param_key")).PageGroups  }}

Ok, that’s cool. I think I just answered my own question.

Perhaps the docs page Pagination | Hugo could reference the https://gohugo.io/templates/lists/#group-content page? For me, it was not obvious to go and look for a “group content” doc page when on the pagination page:

Anyway, thank you!

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