Reorder query by a content relationship field

For example I have the custom type Product, with the content relationship field Category. The Category custom type has a field Title and would like to order Products by the Category Title field.

Ive tried orderings: ["my.product.category.title"] and orderings: ["my.product.category.category.title"] with no luck.

Is this possible?


Hello @jack

Thanks for reaching out to us.

What version of @prismicio/client do you have in your project? If you have v6, then applying the orderings param object is different. Learn more about params object here.


Hi @Priyanka

Im using @nuxt/prismic, which I believe uses @prismic/client v ^4.0.0 or ^5.1.0.

Ive read the documentation but it doesn't answer my question.


Hello @jack

It will not be possible to have the sorted results based upon a linked content relationship field.
What you can do here is to have the category title in the results using fetchLinks. Later, when you get the list on the front end, you can sort the JSON objects array based upon a property value.

Let me know if you have any further questions.