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.
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 )]
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)
Thank you so much, this seems even better for the content creator to use.
Works like a charm πŸ™‚
Fantastic!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?