
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI understand you're trying to connect manual ordering in Sanity Studio to your Gatsby site's display order. Let me clarify how this works, because there are actually two separate concepts at play here.
The key distinction:
Studio sort orders (defined in your schema's orderings property) only affect how documents appear within the Studio UI itself. These are purely for editor convenience and don't create any queryable field.
Manual drag-and-drop ordering (via the @sanity/orderable-document-list plugin) creates an actual orderRank field on your documents that you can query in Gatsby.
To make ordering work in your Gatsby site:
The @sanity/orderable-document-list plugin adds an orderRank field to your documents when you drag and drop them in Studio. This is the field you need to sort by in your GROQ queries.
First, make sure you've added the orderRank field to your schema:
import {orderRankField} from '@sanity/orderable-document-list'
{
name: 'yourDocumentType',
type: 'document',
fields: [
orderRankField({ type: 'yourDocumentType' }),
// ... other fields
]
}Then in your Gatsby queries, sort by the orderRank field:
*[_type == "yourDocumentType"] | order(orderRank)The orderRank field will only exist on documents that have been manually ordered using the plugin. For documents without it, you can provide a fallback:
*[_type == "yourDocumentType"] | order(orderRank asc, _createdAt desc)This way, manually ordered documents appear first (in your chosen order), and any unordered documents follow, sorted by creation date.
Important notes:
orderRank field is created and maintained by the plugin when editors drag-and-drop documents in the orderable list viewpublishedDate desc in Studio, use that same sort in your query)The plugin's GitHub README has complete setup instructions, including how to configure the desk structure to enable the drag-and-drop interface.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store