πŸ‘€ See Sanity in action: Watch product demo now β†’

How to Change a Post's Position in the Object of Posts

5 replies
Last updated: Oct 3, 2022
is there a way to change a posts position in the object of posts? I have the order-documents plugin, would be nice if the order i change them in reflects the posts positions on my front-end, been googling but alas i cannot find anything. More info in thread.
Sep 30, 2022, 2:11 PM
I think i need to include
 | order(order asc)
but i cannot get it to work in my query.

*[_type == "post"  && references(*[ title == "frontpage" ]._id )]
Sep 30, 2022, 2:13 PM
You can get the documents in the order you've set if you order by
orderRank
. Here's the example from the plugin's docs:
*[_type == "category"]|order(orderRank)
Sep 30, 2022, 4:29 PM
Thank you so much, this seems even better for the content creator to use.
Oct 3, 2022, 7:10 AM
Works like a charm πŸ™‚
Oct 3, 2022, 9:08 AM
Fantastic!
Oct 3, 2022, 3:34 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in