riichard/jekyll-rest-api

Paginator?

tanrax opened this issue · 1 comments

It would be great to have a paginator, maybe creating different json for each page :)

That would be useful indeed, especially for bigger websites where you'd like to load the content in chunks. I think in all cases it'd be better to paginate on the client-side, but sometimes your data might be too much.

It's quite challenging to fix this issue it in a clean way. Jekyll has disabled the paginator function in their newer versions. And it only would've worked on the index page, forcing you to change your entire website.

Another way to fix it would be duplicating the posts.js file like you said, and make each file select a different offset of posts in the for-loop.
How many posts you'd like to display is then optional, depending on the sizes of your posts. Given the small size of this project, I think it's easier if you edit it to your custom needs. Rather than adding extra APIs here that are too use specific.

Let me know if you need any help with that.