Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m trying to set a song’s duration with Microdata. What is the best way to describe a duration in Microdata?

Is it by using itemprop="duration" in span?

<span itemprop="duration" content="PT4M5S">4:05</span>

Or using the time element?

<time itemprop="duration" datetime="PT4M5S">4:05</time>

Or using the meta element?

<meta itemprop="duration" content="PT4M5S"/>4:05

Or a combination of all of them?

<span itemprop="duration" content="PT4M5S">
    <time itemprop="duration" datetime="PT4M5S">
        <meta itemprop="duration" content="PT4M5S"/>4:05

I tried and they all worked in Google’s Structured Data Testing Tool, except for the last one where the result were three durations!

share|improve this question
up vote 0 down vote accepted

The duration property expects a Duration as value, which has to be in the ISO 8601 duration format.

The time element can have a "valid duration string" as value (which is based on one of the ISO 8601 formats). Your value "PT4M5S" would be valid.

So you should use

<time itemprop="duration" datetime="PT4M5S">4:05</time>

Microdata parsers have to use the value of the datetime attribute, if present.

(You should use the meta element only if you can’t markup visible content.)

share|improve this answer

Complete details along with examples can be viewed on MusicRecording Schema.

Specifically, the below is the correct markup for this type of data:-

<div itemscope itemtype="http://schema.org/MusicGroup">

<h1 itemprop="name">Foo Fighters</h1>

<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
  <h2>Video: <span itemprop="name">Interview with the Foo Fighters</span></h2>
  <meta itemprop="duration" content="T1M33S" />
  <meta itemprop="thumbnail" content="foo-fighters-interview-thumb.jpg" />
  <object ...>
    <param ...>
    <embed type="application/x-shockwave-flash" ...>
  <span itemprop="description">Catch this exclusive interview with
    Dave Grohl and the Food Fighters about their new album, Rope.</span>


<div itemprop="track" itemscope itemtype="http://schema.org/MusicRecording">
  <span itemprop="name">Rope</span>
  <meta itemprop="url" content ="foo-fighters-rope.html">
  Length: <meta itemprop="duration" content="PT4M5S">4:05 -
  14300 plays<meta itemprop="interactionCount" content="UserPlays:14300" />
  <a href="foo-fighters-rope-play.html" itemprop="audio">Play</a>
  <a href="foo-fighters-rope-buy.html" itemprop="offers">Buy</a>
  From album: <a href="foo-fighters-wasting-light.html"
    itemprop="inAlbum">Wasting Light</a>

<div itemprop="track" itemscope itemtype="http://schema.org/MusicRecording">
  <span itemprop="name">Everlong</span>
  <meta itemprop="url" content ="foo-fighters-everlong.html">
  Length: <meta itemprop="duration" content="PT6M33S">6:33 -
  <span itemprop="playCount">11700</span> plays
  <a href="foo-fighters-everlong-play.html" itemprop="audio">Play</a>
  <a href="foo-fighters-everlong-buy.html" itemprop="offers">Buy</a>
  From album: <a href="foo-fighters-color-and-shape.html"
    itemprop="inAlbum">The Color And The Shape</a>

<h2>Upcoming shows</h2>

<div itemprop="event" itemscope itemtype="http://schema.org/Event">
  <a href="foo-fighters-may20-fedexforum" itemprop="url">
    <span itemprop="name">FedExForum</span>
  <span itemprop="location">Memphis, TN, US</span>
  <meta itemprop="startDate" content="2011-05-20">May 20
  <a href="ticketmaster.com/foofighters/may20-2011" itemprop="offers">Buy tickets</a>

<div itemprop="event" itemscope itemtype="http://schema.org/Event">
  <a href="foo-fighters-may23-midamericacenter" itemprop="url">
    <span itemprop="name">Mid America Center</span>
  <span itemprop="location">Council Bluffs, IA, US</span>
  <meta itemprop="startDate" content="2011-05-23">May 23
  <a href="ticketmaster.com/foofighters/may23-2011" itemprop="offers">Buy tickets</a>

<h2><a href="foo-fighters-photos">28 Photos</a></h2>
<a href="foofighters-1.jpg" itemprop="image"><img src="foofighters-thumb1.jpg" /></a>
<a href="foofighters-2.jpg" itemprop="image"><img src="foofighters-thumb2.jpg" /></a>
<a href="foofighters-3.jpg" itemprop="image"><img src="foofighters-thumb3.jpg" /></a>

Excited about seeing them in concert next week. -Lawrence , Jan 23
I dig their latest single. -Mary, Jan 19
<meta itemprop="interactionCount" content="UserComments:18" />
Showing 1-2 of 18 comments. <a href="foofighters-comments">More</a>

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.