I’ve been looking around for examples on how to use pagination with the related function, but had no luck so I’ve been trying to figure it out for the past few hours.
Here’s what I’ve got so far. The following code gives all the related content. No issues.
Yes you can, but it’s restricted to the list type of pages. But I guess there are two variants here: 1) To Paginate the related pages or 2) Find related pages for the paginated pages. Both should be possible but I guess you want 2).
It’s hard for me to judge exactly what’s going on in your case, but there can only be one paginator for a given list page (Hugo is static), so I added that error – because it’s a common mistake to try to paginate multiple page sets.
I’ve been troubleshooting for a bit now. I have over 2000 posts, and it seems the error has nothing to do with the quantity of posts or pagination being called multiple times.
The error was happening because for some reason, the paginator did not like the keywords in two of my posts. In one post I had, keywords = ["a", "b"], and in the other keywords = ["c", "d"]. Nothing wrong with this front matter that I can tell – I’m using these exact keywords in other posts – but that’s why the error was occurring. If I removed “b” and “d” from keywords in those two posts, no error and pagination worked as expected.
Here’s the kicker, upgrading from v0.53 to the latest version fixed the error! So perhaps a weird glitch in the previous version?
OK, now I remember. I fixed an issue with sorting or related pages. I added the page name as a last sort argument to get stable sorting for related pages with same date + keywords. This explains the behaviour you see.