
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see you're getting an error when trying to add a url type element to your array. The issue here is that url is a primitive string type, while image is a complex object type, and mixing them directly in an array can cause problems in the Studio UI.
The standard approach to fix this is to wrap your URL in an object type so both array members have a consistent structure:
{
name: 'referenceList',
type: 'array',
title: 'References',
of: [
{
type: 'object',
name: 'urlReference',
title: 'URL Reference',
fields: [
{
name: 'url',
type: 'url',
title: 'URL'
}
]
},
{
type: 'image',
name: 'imageReference',
title: 'Image Reference'
}
]
}The image type is already a complex object with internal structure (asset reference, hotspot, crop data, etc.). When you try to mix a primitive url type directly with image, the Studio has trouble rendering the array interface consistently. By wrapping the URL in an object, you're giving both array members a similar structure, which makes the Studio UI work smoothly.
According to the Sanity documentation on array fields, arrays support multiple member types, and this pattern of wrapping primitives in objects is commonly used when combining different content types.
When you query this structure, you can differentiate between the types using the _type field that Sanity automatically adds:
*[_id == "your-doc-id"] {
referenceList[] {
_type,
_type == "urlReference" => { url },
_type == "imageReference" => {
asset->
}
}
}Wrapping the URL in an object also gives you:
title, description, or linkText) without restructuring your dataThis pattern is a common practice in Sanity schemas when you need to mix different content types in arrays, especially when combining primitive types with complex types like images or references.
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