docs
MusicRecording
The MusicRecording schema type describes a single music track or sound recording. It is the building block of music metadata — used by streaming services, lyric sites, and label catalogues to surface tracks in Google's music carousel.
About MusicRecording
Always express duration in ISO 8601 (e.g. PT3M45S) — Google rejects free-form durations like "3:45". For full discography pages, group recordings under their parent MusicAlbum so search engines can model the relationship between an album and its tracks.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | ✓ | The name of the music recording (track title). |
description | text | — | A description of the music recording. |
image | url | ImageObject | — | Cover art or image for the recording. |
byArtist | url | Person | — | The artist who performed this track. |
duration | string | — | ISO 8601 duration, e.g. "PT3M45S" for 3m 45s. |
inAlbum | string | — | The name of the album this recording appears in. |
datePublished | date | — | Release date of this recording. |
Plugin Registration
sanity.config.ts
import { defineConfig } from 'sanity'
import { schemaOrgMusicRecordingPlugin } from 'sanity-plugin-seofields/schema'
export default defineConfig({
plugins: [
schemaOrgMusicRecordingPlugin(),
],
})Schema Usage
Add theschemaOrgMusicRecording field to any document schema:
schemas/track.ts
import { defineField, defineType } from 'sanity'
export default defineType({
name: 'track',
title: 'Track',
type: 'document',
fields: [
defineField({
name: 'schemaOrgMusicRecording',
title: 'MusicRecording Schema',
type: 'schemaOrgMusicRecording',
}),
],
})GROQ Query
GROQ query
*[_type == "track"][0]{
schemaOrgMusicRecording {
name,
description,
image,
byArtist,
duration,
inAlbum,
datePublished
}
}Next.js Component
app/track/[slug]/page.tsx
import { MusicRecordingSchema } from 'sanity-plugin-seofields/schema/next'
export default function Page({ data }) {
return <MusicRecordingSchema data={data.schemaOrgMusicRecording} />
}JSON-LD Output
Generated JSON-LD
{
"@context": "https://schema.org",
"@type": "MusicRecording",
"name": "Get Lucky",
"description": "Lead single from Random Access Memories featuring Pharrell Williams and Nile Rodgers.",
"image": "https://example.com/covers/get-lucky.jpg",
"byArtist": {
"@type": "MusicGroup",
"name": "Daft Punk"
},
"duration": "PT6M07S",
"inAlbum": "Random Access Memories",
"datePublished": "2013-04-19"
}Was this page helpful?