Attribute pubdate not allowed on element time at this point
Asked Answered
S

2

12

I have an 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?

Surprise answered 19/4, 2013 at 9:29 Comment(0)
P
6

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

Preheat answered 27/6, 2014 at 15:5 Comment(3)
More relevant reference then a "code example" is the schema.org specification at schema.org/Article. This is the place where the itemprop comes from. Backed by Google, Bing, Yahoo and others..Excurvate
the itemprop markup does not w3c validate without proper schema.org/docs/gs.html#microdata_itemscope_itemtypeExcurvate
Another useful discussion on the subject.Mathematics
D
3

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

Defeat answered 15/11, 2013 at 13:14 Comment(1)
a Bruce Lawson's article from 2012 claims that the pubdate attribute was dropped from the html specification as not needed, see brucelawson.co.uk/2012/best-of-time. Correct replacement for use by search engines seems to be using the microformats, see schema.org/docs/faq.html#1Excurvate

© 2022 - 2024 — McMap. All rights reserved.