Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the currently correct way to mark publication date on a HTML page?

Tags:

html

For what I Google-searched, looks like that the <time> element was dropped and bring back to HTML5 specs later (right?) *

I want to clarify:

  • *Right now*, what is the correct way to mark the publication date on an article on a HTML page?

  • Is pubdate still supported?

I'm using the following way:

<time datetime='2014-07-02' pubdate>July 2014</time>

Is it correct?


* [1][2][3][4][5][6]

like image 996
talles Avatar asked Oct 01 '22 10:10

talles


1 Answers

I would embed schema.org Article structured data on the page and use the datePublished property.

From their homepage:

This site provides a collection of schemas that webmasters can use to markup HTML pages in ways recognized by major search providers... Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results, making it easier for people to find the right Web pages.

Here's an example, adapted from the Article example to include datePublished per the spec for dates, which you'll note uses the time element:

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="name">How to Tie a Reef Knot</span>
  by <span itemprop="author">John Doe</span>
  published <time itemprop="datePublished" datetime="2014-07-02">July 2nd, 2014</time>
</div>

To answer whether pubdate is still supported, you can refer to the latest HTML5 spec directly, and see that aside from global attributes, the only other attribute specified is the datetime attribute for indicating a machine-readable version of the content. If you scroll further, one of the examples for this element in the spec uses the schema.org vocabulary for an article's publication date.

Using a microdata format like schema.org will ultimately give you more control over how search engines and other crawlers interpret the data on your page.

like image 109
Michael Petito Avatar answered Oct 04 '22 16:10

Michael Petito