How to apply custom ordering to documents in Sanity?

77 replies
Last updated: Jan 27, 2026
Hi Sanity folks! I can't find an existing, usable solution for applying an arbitrary order to documents? The best I can come up with is an
order
field of type
number
and manually tweak those, but that's a real pain. Any ideas or recommendations for existing pluings that might handle this?
AI Update

Good news! There's an official plugin that solves exactly this problem: @sanity/orderable-document-list.

This plugin gives you drag-and-drop ordering directly in the Studio editing interface, so you don't have to manually fiddle with number fields anymore. It's maintained by the Sanity team and works by adding an orderRank field to your documents behind the scenes.

Installation:

npm i @sanity/orderable-document-list

The plugin is designed for Studio v3 (for Studio v2, you'd need the @studio-v2 tag, but that's deprecated now). You can find the full setup instructions in the GitHub README.

Why this is better than a manual order field:

  • No more manually adjusting numbers when you want to reorder
  • Drag-and-drop interface is way more intuitive for content editors
  • The ordering persists and can be queried from your frontend
  • Handles the complexity of maintaining order ranks automatically

Alternative approaches (if the plugin doesn't fit your use case):

  • Create a singleton document with an array of references to control order
  • Use wrapper documents containing reference arrays
  • Stick with the numerical order field approach (though as you've found, it's tedious)

The orderable document list plugin works great for small to medium-sized collections where manual ordering makes sense. For very large datasets, you might want to consider query-based sorting instead.

Show original thread
77 replies

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?