Skip to main content
seofields
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

FieldTypeRequiredDescription
namestringThe name of the music recording (track title).
descriptiontextA description of the music recording.
imageurl | ImageObjectCover art or image for the recording.
byArtisturl | PersonThe artist who performed this track.
durationstringISO 8601 duration, e.g. "PT3M45S" for 3m 45s.
inAlbumstringThe name of the album this recording appears in.
datePublisheddateRelease 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?