Streaming live at 10am (PST)

How to have a "Next" and "Previous button on CMS collection items


In my circumstance I’m looking for a way to link to the next, or the previous CMS item (based on date or some other data).

An example of use would be a collection of blog posts, and a button to navigate between them in order.

Does anyone know how to accomplish this?


Not natively, you can simulate it with some work: Native linking to previous and next post or page using CMS


Thanks Vincent!

I considered this approach however we have a collection with nearing 200 CMS items, it would laborious to say the least to go back and implement and upkeep linking them in this way.


Just two custom code workaround suggestions:

If the next/prev items do not need to be in chronological order, then with some custom code we can convert the sitemap.xml file to get the next/prev items.

Or if we can create a hidden page listing all the CMS items in the sort order that we want, we could also do this. However there is a limit of 2000 items per page, so if in the future you’ll have more than that amount, the custom code will break.