Question

I have a HTML 5 document containing the element:

<time datetime='2013-04-18T12:57:59+01:00' pubdate='pubdate'>Thu, 18 Apr 2013 at 0:57PM</time>

This doesn't validate. The error is 'Attribute pubdate not allowed on element time at this point.'

Any idea how to correct this validation error?

Thanks!

Était-ce utile?

La solution

I've made a little research on this subject and it seems that the best way to get around this is to use itemprop="datePublished" attribute.

Check out the code example published at w3.org:

<article itemscope itemtype="http://schema.org/BlogPosting">
  <h1 itemprop="headline">Small tasks</h1>
  <footer>Published <time itemprop="datePublished" datetime="2009-08-30">yesterday</time>.</footer>
  <p itemprop="articleBody">I put a bike bell on his bike.</p>
</article>

Changed my code like that and now validation is passed.

itemprop="published" is also possible when using a fictional microdata vocabulary. Here is the code that validates successfully too:

Posted on <time itemprop="published" datetime="2014-06-24T17:00:00+00:00">June 24, 2014</time>

Note: As xmojmr has commented, itemprop must go with appropriate itemscope itemtype="..." to validate properly.

Reference

Autres conseils

Could be the pubdate attribute is being removed from the specifications. So just don't use pubdate.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top