Age of Article Warning:
This article was originally published 36 months ago. The tips and techniques explained may be outdated, or information may longer be applicable. Please consider this when viewing the below content.

If you’ve been using Google’s Rich Snippets Tool, you might have come across an error for HatomEntry. Under the Extracted structured data, errors may be seen such as:

“Error: At least one field must be set for HatomEntry”, or “Error: Missing required field “entry-title”.

What is hAtom?

According to www.microformats.org/wiki/hatom, “hAtom is a microformat for identifying semantic information in weblog posts and practically any other place Atom may be used … is easily added to most blogs by simple modifications to the blog’s template definitions … hAtom is a microformat for content that can be syndicated”

If Google is testing for hAtom microformat in web pages, then it would be wise to assume that it must play a part in how Google indexes blog articles using microformats.

There are different ways that you can fix this issue, however the basic requirements are that certain classes are added into your blog page’s source code.

  1. “Hentry” * must appear in the article class or the post class such as:
    <article class="hentry"></article>

    *If you are getting the HatomEntry error on Google Rich Snippets Tool, then this class name must already exist in your page’s source code. View the source code and do a search for “hentry” to verify.

  2. “Entry-title” must appear as a class name in the title:
    <h1 class="entry-title">Title of Blog Post</h1>
  3. “Updated” must appear as a class name for the date the post is modified or published:
    <time class="updated"> December 29th, 2013</span>
  4. hCard “author” fields must also appear by adding:
    <span class="author vcard"><span class="fn">Author's name</span></span>
  5. “Entry-content” class should be added to your blog article’s content:
    <div class="entry-content">
        <p>the text content of the article</p>
      </div>

How to modify the source code to fix hAtom errors?

There are different ways to modify your code. You could edit the single.php template file in your theme or childtheme, or any other files that control your blog article pages, and add in the extra class names into the correct spots.

Alternatively, and I think that this is probably an easier modification for people who are unsure how to modify post templates, you can add the below code to your functions.php file of your WordPress childtheme. If you use a custom mu-plugin for your website then you could add the code there instead.

The code contains 2 functions. The first function will use the WordPress filter hook for “the_content” to add the class of “entry-content” to the article. To add in the other essential hAtom fields, the second function will add a short sentence to the end of your post article, which contains updated time, post title and author, with required microdata.

//mod content
function hatom_mod_post_content ($content) {
  if ( in_the_loop() && !is_page() ) {
    $content = '<span class="entry-content">'.$content.'</span>';
  }
  return $content;
}
add_filter( 'the_content', 'hatom_mod_post_content');

//add hatom data
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()) {
		$content .= '<div class="hatom-extra"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
	}
	return $content;
	}
add_filter('the_content', 'add_mod_hatom_data');

This is the result now when testing with the Google Rich Snippets Tool:

hAtom microdata

I have added some css styling to the extra sentence that is added to the end of each blog post, as I prefer to display the last modified post date, however if you would prefer to hide it all together you can:

/* style for extra sentence */

     .hatom-extra {font-size:10px; font-weight:400; font-style:italic;}
     .hatom-extra .entry-title {text-transform:uppercase;}


/* alternative style to hide sentence from view */
     
     .hatom-extra {display: none;}

**special updates – VIDEO TUTORIAL and WORDPRESS PLUGIN NOW AVAILABLE:
This article has become a very popular topic of discussion, and a good source of information for WordPress users around the world. I have spent a great amount of time trying to assist where possible in the comment section below.

As a result of discussions, I have decided to spend time putting together a video tutorial that expands on the instructions in the tutorial above, to help those who are still unsure how to implement the solution.
This video is available for a small price of an average cup of coffee here in Australia. If you would like to purchase, to show your appreciation of my efforts in helping others fix hAtom errors, then that would be nice.

– purchase no longer available. Video still available below for members.

DT hAtom Error Removal Plugin

I have also just released DT hAtom Error Removal Plugin, if you prefer to use a plugin – View plugin details and payment options

Premium Club Members can view video below:

This content is for members only.
Log In Register
Fix hAtom microformats – at least one field must be set for HatomEntry was last modified: September 19th, 2016 by David Tiong
Fix hAtom microformats – at least one field must be set for HatomEntry