ReeceM / prismic-sitemap

A sitemap generator for next.js websites based on the pages in your Prismic backed Next.js application. Minimal Configuration
MIT License
12 stars 3 forks source link

Paginator doesn't work #14

Closed kb1995 closed 2 years ago

kb1995 commented 2 years ago

Describe the bug

I just started working on an existing codebase which uses this package. There are more than a 100 articles, but only the first 100 articles are displayed in the sitemap (using the pageSize option of a 100).

I looked at the codebase and it looks like it's due to this conditional:

    if (total_pages > this.nextPage) {
      return this.paginate(type, page + 1)
    }

I don't think you set nextPage anywhere in the file, meaning that this condition will always be false.

This is the conditional I've used in previous Prismic projects:

if (response.results_size + routes.length < response.total_results_size) {

I think this condition might work (but I haven't done any tests though):

    if (total_pages > next) {
      return this.paginate(type, page + 1)
    }
ReeceM commented 2 years ago

Hey @kb1995,

Thank you for picking this up 💯; it is very possible what you mentioned happened, I'll check the tests too in that case.

I'll have a look at it this evening. 💯👍

kb1995 commented 2 years ago

@ReeceM Thanks for the quick response. Let me know if I can help with anything

ReeceM commented 2 years ago

I will definitely do so 👍

ReeceM commented 2 years ago

Hey @kb1995, so the issue auto closed, but if you don't mind testing the latest version when you can it would be cool.

If it doesn't please open the issue again 💯

kb1995 commented 2 years ago

Hey @ReeceM, I just tested it and it works. Thanks for sorting out this issue so quickly!

ReeceM commented 2 years ago

Awesome, glad it is working 👏👏😁