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.
54 Responses to “Fix structured data errors (HATOM) in Google Webmaster Tools”