
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou'll want to use an array field with object members for your episode schema! This is perfect for your use case where each episode needs multiple streaming links.
Here's how to structure your series schema:
import {defineType, defineField, defineArrayMember} from 'sanity'
export default defineType({
name: 'series',
title: 'Series',
type: 'document',
fields: [
defineField({
name: 'title',
title: 'Series Title',
type: 'string',
}),
defineField({
name: 'seasons',
title: 'Seasons',
type: 'array',
of: [
defineArrayMember({
type: 'object',
name: 'season',
title: 'Season',
fields: [
{
name: 'seasonNumber',
title: 'Season Number',
type: 'number',
},
{
name: 'episodes',
title: 'Episodes',
type: 'array',
of: [
defineArrayMember({
type: 'object',
name: 'episode',
title: 'Episode',
fields: [
{
name: 'episodeNumber',
title: 'Episode Number',
type: 'number',
},
{
name: 'title',
title: 'Episode Title',
type: 'string',
},
{
name: 'streamingLinks',
title: 'Streaming Links',
type: 'array',
of: [
defineArrayMember({
type: 'object',
name: 'link',
fields: [
{
name: 'url',
title: 'URL',
type: 'url',
},
{
name: 'platform',
title: 'Platform Name',
type: 'string',
description: 'e.g., Netflix, Prime Video, etc.'
},
{
name: 'quality',
title: 'Quality',
type: 'string',
options: {
list: ['720p', '1080p', '4K']
}
}
],
preview: {
select: {
title: 'platform',
subtitle: 'url'
}
}
})
]
}
],
preview: {
select: {
title: 'title',
episode: 'episodeNumber'
},
prepare({title, episode}) {
return {
title: `Episode ${episode}: ${title}`
}
}
}
})
]
}
],
preview: {
select: {
season: 'seasonNumber'
},
prepare({season}) {
return {
title: `Season ${season}`
}
}
}
})
]
})
]
})This schema gives you:
In the Studio, users will:
You can also add validation if needed (like requiring at least one streaming link per episode):
{
name: 'streamingLinks',
title: 'Streaming Links',
type: 'array',
validation: Rule => Rule.required().min(1).error('At least one streaming link is required'),
of: [...]
}The array field documentation has more details on customization options if you want to enhance the UI further!
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