The Real Solution: How To Fix "datePublished" Structured Data Error in Blogger

Fix datePublished error in Blogger

If Google's Structured Data Testing Tool gave you an error of either missing "required" or "unrecognizable" for datePublished, there's a little chance that you've read Google Support's instruction to read on ISO 8601 on Wikipedia which shows the formats for date. Here's a screenshot of the table for the date formats:
ISO 8601 date formats

As you can see from this website, I have a customized and Javascripted format for the date so that it will fit on a circular container. I'm not sure if it helped because this was my chosen date header format:
Blogger Date Header Format

Like me, perhaps you've followed tutorials that will add the class updated on the timestamp link which actually helped fix the error for "updated" but is actually useless for the date. How does that fix even make sense for the date? It's just timestamp. I don't know about you because that one didn't help me.

With some thinking today, I realized I overlooked on something. After rectifying that error, I realized how stupid I had been. Anyway, to beat all the stupid in us, here's the fix that I found which actually did the job:

Step 1: Ctrl + F hentry.

Hentry appears twice. If you don't rely on Blogger's mobile styling for mobile phones, then ignore the one in mobile, instead focus on the useful one which is inside <b:includable id='post' var='post'>. Basically, you'll see a code similar to this:

<div class='post hentry uncustomized-post-template' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>

Below this code, simply add this code: <meta expr:content='data:post.dateHeader' itemprop='datePublished'/>
That's it! If you haven't noticed like I did for years, Blogger expresses date through its internal code for date-header. That's what we should have been using right from the start.

Step 2:If you've added other fixes that generated no result, then delete all other occurrences of itemprop='datePublished' to remove the error generated by this (the unrecognizable error). Otherwise, carry on.

Tell me in the comment section if it worked for you.

3 Comments

Post a Comment


  • SHARES





More from Zirev