Sorting documents on front end

Hello

I have a question related to this topic. It seems there is some issue with ordering numbers. Currently in the backend we have setup the ordering by posts title. Some of our posts titles are ordered by number (in current example by weeks) and we would like to display them correctly, but currently it sets 3 after 29. Is there anything that is currently possible with the API to solve this issue?

Best regards
Tristan

Are those items products, content relationship fields, or group items? If possible, could you record a video so we can take a closer look? Thanks!

Hi.

These are pages created in prismic dashboard. They have a custom type added (in current example type = blog). We fetch them from prismic API via our node express backend server with prismic client.get function. We also pass filter and sort methods to the function (sort by title, { field: "my.blog.title" }).

@Pau

any information on the topic?

Hey tristan, the API sorts titles as strings, so numbers won’t show up in the right order by default. You’ll need to handle the ordering on the front end.