contentful_middleman icon indicating copy to clipboard operation
contentful_middleman copied to clipboard

How to set the pagination?

Open t1gerk1ngd0m opened this issue 4 years ago • 1 comments

Hello, I use this gem on our corporate blog site. It's easy to access to the Contentful.

But I'm in trouble because I cannot set the pagination. Are there any good way to set the pagination?

t1gerk1ngd0m avatar Jul 27 '20 08:07 t1gerk1ngd0m

If you're fetching the content using all_entries: true, then it's a matter of defining either in the proxy section of your config the pages, by calculating the amount of entries you have vs how many you want per page, then passing those numbers (current page/page size) through locals where you can use them to iterate over your collection and skipping/collecting the right amount of entries. Or having all of them directly in a single page and having your pagination done using some frontend framework (the data always being there, just hidden to the user until they scroll to the appropriate page).

Hope this helps

dlitvakb avatar Jul 27 '20 09:07 dlitvakb