Helping Google find a date

I published an article on my website, and Google seems to be struggling to see the “Published on 2016-01-05” as a date.

How can I mark things up so search engines don’t see this as part of the article but as metadata?

In the search results in Google, I want something like this…




And NOT like this…

Here is the HTML my PHP geenrates…

<?php
    echo "<header>";
    echo "    <h1>$heading</h1>\r\n";
    echo "    <div class='publishedOn'>Published:" . "&nbsp;&nbsp;" . $publishedOn_f    . "</div>\r\n";
    echo "</header>";
    echo $body;
?>

:frowning:

How did you mark up the date you do have?

See my edit above.

Looking at that, you’ve not marked the data up as a date. Try looking up microformats - http://microformats.org

Yes, for example, searching for “Using the RulerZ Rule Engine to Smarten up Playlist Building” brings up

Using the RulerZ Rule Engine to Smarten up Playlist Building
www.sitepoint.com/using-the-rulerz-rule-engine-to-smarten-up-playlist-b...
Dec 2, 2015 - Christopher Pitt shows us how we can use RulerZ, the PHP rule engine, to smarten up playlist song selection by applying constraints and filters!

Looking at the view-source for that article, the only place “December” is in the mark-up is

<time datetime="2015-12-02" pubdate>December 02, 2015</time>

As I read, isn’t there a way to do this in HTML?

I am leery of using things that are fads and will not be supported down the raod.

Also, a few weeks ago I looked into Google’s Structured Data, but the impression that I got from it is that I have to manually go in and markup every web page so Google knows what is what. (What happens if you have a website with 10,000 pages???) :unamused:

You can use the <time> tag.
It can be further enhanced with structured data to explicitly tell bots that it is the published date.

I don’t follow what you are referring to…

Is that HTML5?

Will that code fix my problem?

Then it is driven by databases, and such data is recorded, stored in and pulled from them to populate such tags automatically.

With Google’s Structured Data, you have to go into each web page, select text you want marked up a certain way, and submit it, right?

Even though my website is data-driven, my understanding is I would still have to go into each article or web page and tell Google what is what, because you are marking up content and not tags, right?

I think you are referring to the “Data highlighter” in WMT, you don’t have to do it that way.
Structured data can be put into the html tags.

echo 'First published <time itemprop="datePublished" datetime="'.$pubtime.'">'.$pubstring.'</time>';

I thought I read recently that the < time > tag, or maybe it was “datetime” was not widely supported by browsers?

If you consider almost everything except IE8 , not widely supported, then yes.
Supposing it’s not supported, what’s the worst that can happen?

The time tag looks pretty well supported as a semantic element according to http://caniuse.com/#search=Time

It says Global60.24% + 8.48% = 68.72%

That is only 2 out of 3 browsers, right?

That’s the input type for forms. See my link.

You’re reading the wrong section - try further down the page where it says “semantic elements” - http://caniuse.com/#feat=html5semantic

It doesn’t actually matter if a browser recognises the <time> tag since if it doesn’t recognis a tag it will ignore it. Your OP was about Google recognising it so Google recognising it is what is important,

2 Likes

I find that website extremely hard to read. How in the world would you know to type in “semantic elements”? :confused:

Equally confusing is this…
https://www.w3.org/TR/html-markup/time.html

Where are the attributes for < time > like “pubdate”?

How well supported is this? Looks like some fly-by-night group to me.