In defence of pubdate

←Back to listing

At the end of October, the <time> element was removed from the HTML5 specification. I and others blogged on our dismay at this, but thankfully the decision was reversed and the <time> element was restored to the specification. This is good.

However, the pubdate attribute is also under threat of disappearing, and I even joined the W3C to register my opposition to the removal of the pubdate attribute.

What does the pubdate attribute do?
As it stands at the moment, the pubdate attribute, which is a Boolean attribute, can be added to a <time> element and it allows you to specify that this particular time value is the published date of the article or relevant data. Or as the W3C specification says:

If specified, it indicates that the date and time given by the element is the publication date and time of the nearest ancestor article element, or, if the element has no ancestor article element, of the document as a whole.

This, to me, is quite handy. It allows anything that might be traversing the page to instantly locate and recognise the publication date of articles or data on a page. This can only be a good thing, as it helps to indicate how recent the data on the page actually is. And let’s face it, most articles on the web have a published date, so the data itself is prevalent.

Google themselves have hinted how useful being able to do such a thing might be (although they don’t specifically talk about the <time> element nor the pubdate attribute).

In my defence of the pubdate attribute to the W3C, I gave a simple example of a list of events or concert dates on a page, which could of course be littered with <time> elements, only one of which is the actual published date of the listing. Surely it would be very useful to be able to locate this date quickly, and accurately?

An argument against this suggested that a Microdata vocabulary like vEvent could be used to list the timings, in which case the pubdate attribute wouldn’t be of any use. I must admit, I know nothing of this vocabulary, having never used it. But if I, a fairly seasoned web developer, knows nothing about it, what chance do non-developers have of supplying such useful information? Surely it’s our job to make things easier, and adding a simple attribute to a specific element would be much easier than learning some Microdata vocabulary. In addition, CMS’ like WordPress could automatically enclose the published date in a <time> element containing the pubdate attribute.

It was mentioned, and I agree, that this does lead to the problem of the pubdate attribute not necessarily reflecting how recent the data on the page might be. Since pubdate indicates when the data was published, it doesn’t reflect any changes that might have taken place since.

This leads me to two suggestions:

  1. The pubdate attribute should always indicate the latest modified date of the data in question. This of course then makes the name of the attribute itself potentially misleading
  2. The pubdate attribute should stay as it is, and another attribute, the moddate attribute should be added which allows the modified date to be specified in an alternative <time> element. If both the moddate and pubdate attributes appear on the same <time> element, then moddate takes precedence

Feedback Required
These are just some thoughts I’m throwing out there and I’d be interested in hearing other people’s feedback and perhaps any “real world” data on how much the pubdate attribute is currently being used.