prismicio / prismic-client

The official JavaScript + TypeScript client library for Prismic
https://prismic.io/docs/technical-reference/prismicio-client
Apache License 2.0
169 stars 61 forks source link

Navigation between adjacent elements #332

Closed stefan-garofalo closed 9 months ago

stefan-garofalo commented 9 months ago

Is your feature request related to a problem? Please describe.

When building blogs or other repeatable pages it is often needed to link adjacent items and provide prev/next navigation. I couldnt find a solution in the docs to retrieve such data

Describe the solution you'd like

Id like if it were possible to embed such data in the API responses of each repeatable page instance, either by default or given a parameter passed.

Describe alternatives you've considered

Right now I could only think of creating the prev/next field in slicemachine using relations and manually populate it in the builder. UIDs are not incremental so I cant arithmetically navigate

I tried looking for similar issues/discussions but couldnt find any, if this feature already exists I'll be happy to close the issue

github-actions[bot] commented 9 months ago

This issue has been labeled as a feature request since it was created using the 🙋‍♀️ Feature Request Template.

Hi there, thank you so much for your request!

Following our Maintenance Process, we will review your request and get back to you soon. If we decide to implement it, will proceed to implement the feature during the last week of the month. In the meantime, feel free to provide any details to help us better understand your request, such as:

If you think you can implement the proposed change yourself, you're more than welcome to open a pull request implementing the new feature. Check out our quick start guide for a simple contribution process. Please note that submitting a pull request does not guarantee the feature will be merged.

- The Prismic Open-Source Team

stefan-garofalo commented 9 months ago

I just found out there are the after and ordering options to retrieve adjacent items. https://prismic.io/docs/rest-api-technical-reference#orderings

Still sorting on arbitrary order from the page builder would be a cool feature to have though