Fix structured data errors (HATOM) in Google Webmaster Tools
If you have a site based on WordPress with Suffusion theme and check this site with Structured Data Testing Tool from Webmaster Tools -> Other Resources, will get these errors:
hatom-feed | |
hatom-entry: | |
Error: At least one field must be set for HatomEntry.
Error: Missing required field “entry-title”.
Error: Missing required field “updated”.
Error: Missing required hCard “author”.
|
Let’s see what’s happens and how can solve the problem.
According to microformats.org/wiki/hAtom “hAtom is a microformat for identifying semantic information in weblog posts and practically any other place Atom may be used, such as news articles. hAtom content is easily added to most blogs by simple modifications to the blog’s template definitions”. This microformat is implemented on any site by adding it’s specific classes to markup. In this case classes aren’t used for styling elements but for highlighting the elements of microformat. hAtom wasn’t written for Google, was invented for feed readers to know which elements are contained in a post. And Google just read these information’s for knowing how to format their “rich snippets” – those few lines of text that appear under every search result.
Because WordPress is a CMS used basically for publishing articles/blog posts, almost all WordPress themes, if not all, add classes like “hentry” or “hfeed” for content. In Suffusion for general classes of an article is called the WordPress function post_class() which insert the class “hentry”. Those classes are parts of hAtom microformat, telling to feed readers that our sites contains posts. But Google crawler interpret those classes as we want to get rich snippets based on microformats even on sites where we don’t need this.
On a regular site, we don’t need these rich snippets because they will look exactly like actual “poor snippets” – a title with an excerpt of the post. Even we can, for actual snippets, to add exactly the words we want for excerpt, by using SEO plugins (or SEO options from Additional Options for Suffusion). More than that “Marking up your data for rich snippets won’t affect your page’s ranking in search results, and Google doesn’t guarantee to use your markup.” (https://support.google.com/webmasters/answer/99170). In other words those structured data don’t help a site for SEO, don’t have any influence in searching process, may have influence only in the displaying of search result.
But don’t think that rich snippets and structured data are useless, I don’t say that. If you write reviews about some domain or your site organize some events, or present cooking recipes, a nice look of Google snippets can attract more visitors on your site. But this is the plugin territory, Suffusion is not written for recipes, nor for reviews or events, Suffusion is a general purpose theme which is called to display WordPress regular posts.
Anyway, no one like those red errors from Webmaster dashboard. Of course, for correcting these errors, need to respect the entire hAtom microformat markup and add the missing classes in the markup. Almost everywhere on the web is suggested to add these classes in theme templates but will have a hard time for doing this in Suffusion because for generating the content are used much more files than single.php or page.php. But David Tiong proposed on his site the most elegant solution for fixing hAtom errors.
So, in function.php of your child theme of Suffusion add just a function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
//mod content - use this function only if you DON'T USE Suffusion theme function hatom_mod_post_content ($content) { if ( in_the_loop() && !is_page() ) { $content = ''.$content.''; } return $content; } add_filter( 'the_content', 'hatom_mod_post_content'); //add hatom data function add_suf_hatom_data($content) { $t = get_the_modified_time('F jS, Y'); $author = get_the_author(); $title = get_the_title(); if (is_home() || is_singular() || is_archive() ) { $content .= '; ' } return $content; } add_filter('the_content', 'add_suf_hatom_data'); |
That’s it, all hAtom classes are added for posts and pages and Webmaster Tools don’t show microformats errors.
P.S. Read the comments too, some visitors wrote there improved codes or provide links to solutions for other systems like Blogger.
Some errors showing on console in hatom but below it has been said that updated. i just cant make out what does it stand for.
Data Type Source Pages Items Items with Errors
hatom
Markup: microformats.org
44
44
44
once i click specific error. it says like below
/residential-plot-land-for-sale-in-swastik-green-park-new-jail-road-sultanpur-road-in-lucknow/
1
1
2/23/17
Residential Plot / Land for sale in Swastik Green Park, New Jail Road, Sultanpur Road in Lucknow
Missing: author
Missing: updated
Hi Drake,
I am using Alx wordpress theme and getting too much errors in webmaster tool that is
Missing: author
Missing: updated
my website is http://www.promo-suzuki-bandung.com and http://suzukibandung.co.id
can you please check and tell me that how can i resolve this issue??? Please help me.
The solution add classes for the_content hook. Your theme seems to use excerpts for archive pages (home/category/tag pages), so may working to hook the function to the_excerpt.
it is very simple solution and work proferly. but some home page, category page, tag page. its still error. you can check my wordpress site and please give me the solution.
Missing author error is on my site http://www.proforbes.com
i have tried so many solutions but not cleared till yet. Can anyone please help me to get rid of this.
This last solution i have done
https://productforums.google.com/forum/#!topic/webmasters/oeRTb0nvlII
I tested the form and seems to works. But on the site are a lot of anti-spam mechanisms, so could be possible that some messages to be blocked. I sent you a message and you can reply directly to my mail.
Hi,
I’m not able to send you a private message via contact form: Failed to send your message. Please try later or contact the administrator by another method.
Is a character number restriction?
Thank you.
You can add the code after last bracket (“}”) from functions.php
But better is to make a child theme of 2011. In functions.php of the child theme will have only your own functions, NOT copy all functions from parent theme. So, presuming that you will use only the function for correcting hatom errors, your functions.php will look as:
Hi,
Dumb newbie question 🙂
Where in function.php i have to place the code?
Between code or ?
I use the very “rare” twenty eleven…
In advance thank you 🙂
Thank you for the information. It works!!! 🙂
As general consideration, the main error is “At least one field must be set…”. Once you have 2 or 3 field settled right Google will not considering the missing field as required for microformat, hence the green mark “All good”. You still get warnings about the missing field, but the field is not mandatory.
Anyway, the function is working because you have “hatom-extra” class in content, but you’ve tried to add my code in a bad way:
See? My code start as:
You’ve edited the code for making the class visible, but you removed also the closing bracket “>” for the first div, and also you’ve removed exactly the class “entry-title” which is missing.
Try to add exactly my code, without edits, to see if the problem is solved, then make your edits more carefully.
Yeah, its very weird but in my webmaster tools i have the error “Mising entry-title” on every single post
when i test the microformat atom it shows all OK, but there is no entry-title, its like dont exist
i think is better do show you with screenshots, like this you see better: http://i.imgur.com/zvFgHec.png and http://i.imgur.com/mi6xAJX.png
Thank you very much for the help and sorry for my english!
I tested a lot of pages/posts from your site. Google don’t reveal any error and your markup looks fine and contain all needed classes.
Hello,
Thank you very much for this article, its very very good!
I just having problems with “entry-title” and im unable to fix it, i alredy try for days and nothing works 🙁
I hope you can see the code and give me a litle help, i appreciate very much.
Regards and thanks!
Hi Justin, thanks for visit.
I don’t know how it looks your functions.php. When you add new codes, make sure to do this in a real text editor, like notepad (or notepad++, a great free tool for developers, as it highlight the codes in many programming languages). Not use text processors like Word, Wordpad or so, because these alter the quotes and php will not understand their fancy quotes.
Also make sure to not have any space or CR before the first “” from the php file you edit (functions.php)
Thank you for a great tutorial, but I unfortunately cant get it to work.
After pasting the code into my child themes function.php file – my site goes white.
I am not a code expert at all, so there must be something I am doing wrong somewhere.
Once I remove the code the site loads again without errors.
Any help would be appreciated.
Yes, should work with TwentyTwelve without problems. Maybe you will need an extra function to add also .entry-content class (which in Suffusion already exist):
Read the original post of David Tiong for more info about adding HATOM classes for other themes.
Are this tutorial also works with Twenty Twelve theme
Thanks for this solution. I spent some days trying to find a solution for my web http://www.smstoyou.com and finally you have it – you are a master !
Again thanks for this.
How did you fix this in twenty fourteen? I cannot make it work
[Edited – NSFW link – please note, I will remove completelly further comments which contain the link
]THANK YOU SO MUCH! I have been trying to figure out the code to fix my twenty fourteen website on wordpress. I plugged in your code and it completely fixed it!
Hi Sunil, thanks for visit. I don’t know what to say in your case – your theme markup looks very unusual, your posts don’t looks as posts but as affiliate links to amazon.
Anyway, I suggest to read the article of David Tiong linked in my post and the comments to that article, maybe you’ll find a solution.
First of all you need to add also the .entry-content class because your theme don’t seems to add this class. So, before the code from my article need to add:
The code is from David page. Also read the comments to David article, there are also more valuable information.
Hi Drake,
I am using ipin pro wordpress theme and getting too much errors in webmaster tool that is
Missing: author
Missing: updated
my website is http://www.dealshubindia.com
can you please check and tell me that how can i resolve this issue??? Please help me.
man you are the best with this very easy simple solution you saved lots of my time after searching for hours.
regards
Thank you for visit, I’m glad to help. You can try to adjust the code by removing
because your theme seems to add the “entry-title” class.
Hi John, thanks for your visit. Why don’t change “suf” with “pil” if you like? So, “pil” will meaning Pilcrow… suf, pil, dra, dav, campbel, john… whatever… all of these are only notations… In php we can name our functions as we like. Why I choose “suf”? Because we need to think to the future… If I name my function “add-hatom-data” and tomorrow morning WordPress 4.0.1. will come with the same function for fixing the hatom problem, all sites based on my code will be down after upgrading, with a nice WSOD, because we cannot define twice the same function. But by using “suf” my function is different by any others and will not block any site. And this don’t meaning that is applied only to suffusion. The code will work in any theme which use the_content hook.
If you read the post above, can see that these errors don’t have nothing to do with crawling of the site… Google will crawl your site without any problem, with or without these errors… Hatom can influence only the look of the excerpt displayed in search results, without influencing in any way the place in searches.
Finally… on a WordPress site all functions need to work together for the best results – WordPress core, theme, plugins and custom functions – WordPress cannot come with a general solution as we use different themes or different plugins.
But doesn’t “add_suf_hatom_data” language only apply to the suffusion theme ? With suf meaning suffusion? How will this work with other themes?
I’m was using Pilcrow, and pasted David Tiongs code into my function.php, and no change whatsoever. I changed themes now to twenty twelve , since the look approximates the pilcrow theme, pasted some of this fixit code, and still can’t get the structured data testing tool to be able to read the author other updated information. Very irritating that wordpress doesn’t offer an automatic plugin to fix this problem. Just scanning the web, there seems to be lots and lots of people with this problem. Why write a blog post, or have a website, if Google can’t crawl your site because these hatom issues can’t easily be resolved?
Your homepage don’t need hatom classes because don’t have any hatom markup (don’t contain neither hfeed or hentry classes). So, remove “is_home” from conditional block and probably will be fine. Furthermore, if the same error persist on single posts or pages, by removing style=”display:none;visibility:hidden;” from .hatom-extra div, that class will be visible to public.
Hi i thought i solve the issue by adding your string in my function.php page but now i have a problem in the home page. Is there a specific part of the page where i have to paste your string?
The new problem that appears is:
Error: This information will not appear as a rich snippet in search results, because it is contained in a hidden HTML element. Except in special circumstances, Google won’t display content that is not visible to the user. You should mark up the text that actually appears to your users when they visit your web pages.
The solution from article is applicable only for sites based on WordPress and this is not your case. I don’t use Blogger, so I don’t know if your templates are editable, but if they are, you can try to add those missing classes directly in templates.
I tried many tricks to fix the hatom error but could not be successful in resolving it, Could you check out what is actually is the problem with the site
Because your category page appear as been used as blog page, try to use “is_home()” instead of “is_category”.
“is_archive()” return TRUE when
On the other hand, for correcting microformat errors, is required to add in markup exactly those classes which you removed from the code: “entry-title”, “updated” and “author”. If your theme already add some of them, can remove these from code, otherwise exactly this is the idea – to add those classes.
my fix looks like this
function add_mod_hatom_data($content) {
$t = get_the_modified_time(‘F jS, Y’);
$author = get_the_author();
$title = get_the_title();
if ( is_single() || is_page() || is_archive() || is_category()) {
$content .= ‘‘.$title.’ was last modified: ‘.$t.’ by ‘.$author.’‘;
}
return $content;
}
add_filter(‘the_content’, ‘add_mod_hatom_data’);
all is kind a ok but.. still getting Error: Missing required field “updated”. in POST CATEGORIES. I added is_category() but it’s doesn’t make any changes.
Any ideas?
Thanks
I didn’t use Blogger for development of sites, so I cannot speak too much about this. I suppose that a function which address a WordPress hook, will not work anywhere outside WordPress.
can i paste that code in my blogger template..?
No, the function is not specific for Suffusion, need to work for any WordPress theme. Though, if you use another theme, better is to check the post of David Tiong linked in my post, because you could need one more function for adding the class “.entry-content” which in Suffusion is already present. But… I don’t see either ‘hfeed’ or ‘hentry’ classes in your source, so, I don’t know how you see the errors in Google Webmaster Tools. Can you give me the exact link for which you see those errors?
And finally, if you see part of scripts in frontend, usually it is a sign of a broken markup. Checking your site at validator.w3.org can see that is your case. You need to correct all unbalanced tags from your site with or without our function.
I did try your instruction step by step, but some of the scripts appeared right top of the front page.
Then even checking with google, same errors come up as well. Is there any other solution to it?
This code only for the Suffusion theme right?
I use Morphis.
Thanks
Sabastian
I’ve just change my theme and find those error. I try so many suggestion to fix this, but i found this post really help me to solve my problem.
I have tried to find some span and class on my php file but couldn’t find it, may its because a different template file. But this tutorial gave simple way to fix it, only with add a function on function.php now my problem really gone.
Thank you so much.
Hi David,
Thank you for your comment, it make me very proud, coming from you is a great sign of appreciation.
And yes, while all internet resources recommend to edit theme files and add manually those classes, your functions are simply bright – in 3 minutes HATOM errors are gone from any WordPress site, no matter of theme used.
Thank You very much,
Ciprian
Hi Drake,
I see you found my article useful, that’s fantastic. Thanks for your kind words, and glad you were able to apply the technique to the Suffusion theme.
kind regards,
David Tiong
Thank You George, glad to help.
Hello there! This post could not be written any better!
Looking through this article reminds me of my
previous roommate! He always kept preaching about this.
I most certainly will send this article to him. Pretty sure he’s going to have a great read.
Many thanks for sharing!
George wilson
Yes, the solution will works for any theme, and because can be used in child themes is safe in case of updates. However for other themes than Suffusion I recommend to read the post of David Tiong linked in my article, maybe is needed a second function for generating “entry-content”. I don’t used that function because Suffusion already generate this class.
Thanks for this! I was looking for a solution that’s general enough to massage and tweak for any theme (I’m using Twenty Fourteen), and this looks like it should do the trick when I port my child theme over 🙂
Really appreciate it!
Strange, I can’t reproduce this issue. Even if I select Latest Posts for homepage at Settings -> Reading, with excerpts, the classes are added correctly. So I can’t test a solution on my site.
Can try to replace the line “if (is_home……) {” with:
But, there is no problem if you let things as they are – the main error is Error: At least one field must be set for HatomEntry., or in your case at least .entry-title is settled right. (not talking that even “updated” field is settled by Suffusion and is visible in markup, but for some reason Google don’t read that class).
Anyway, in your case maybe it help more to set correctly the markup for microdata, not for microformats. Can take a look at Itemprop WP plugin which can help you to mark the posts as reviews for products.
I just did testing, all ok for posts. Perfect, thanks !
Google Webmaster still reporting same issues for some pages.
For example, the main page :
http://www.astrasuite.com/astrablog/
Looking at Page View for source, there is no “hatom-extra”
But for this page, no problem:
http://www.astrasuite.com/astrablog/used-hifi-for-sale/
Any ideas ?
Thanks again
Hi Joe, glad if I can help. About Aquoid.com, it is a hosting problem, probably they will solve it, but I can’t do anything about that.
Thanks, Drake ! Was trying to log into Aquoid.com and it is down as usual, but google search helped me find this !