
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe issue you're seeing is that the referenced documents don't have a preview configuration set up, so Sanity defaults to showing "Untitled". You need to add a preview configuration to each of the referenced document types (pictureAndText, titleAndText, collection, and link).
Here's how to fix it by adding preview configuration to your referenced schemas:
// pictureAndText.js (example)
export default {
title: 'Picture and Text',
name: 'pictureAndText',
type: 'document',
fields: [
{
name: 'title',
type: 'string'
},
{
name: 'picture',
type: 'image'
},
// ... other fields
],
preview: {
select: {
title: 'title',
media: 'picture'
}
}
}The preview object has two parts:
select: Specifies which fields to use in the previewprepare (optional): Transforms the data before displayFor a basic setup, just using select with a title field is usually enough. If your documents don't have a field literally named "title", adjust it to whatever field makes sense:
preview: {
select: {
title: 'name', // or whatever your main identifying field is
media: 'image' // optional: shows a thumbnail
}
}If you need more control over how the preview displays, you can add a prepare function:
preview: {
select: {
title: 'title',
subtitle: 'description',
media: 'image'
},
prepare({title, subtitle, media}) {
return {
title: title || 'Untitled',
subtitle: subtitle,
media: media
}
}
}Apply this pattern to all four of your referenced document types (pictureAndText, titleAndText, collection, and link), and the references in your array will show meaningful titles instead of "Untitled".
Note: One small issue in your code - you've defined section as type: 'document', but since you're using it as a field type within another document, it should probably be type: 'object' instead. Documents are top-level content types, while objects are embedded within documents.
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