Support » Theme: JustWrite » Google Webmaster Tools Structured Data Microformat/Microdata (hentry) errors

  • Resolved MScrumptious

    (@mscrumptious)


    Google Webmaster tools reports hundreds of Structured Data errors when using this theme. The Data Type that Googlebot seems to have an issue with is “hentry”. It associates the Data Type and corresponding error with taxonomy pages (like tags, categories, etc.) Here is one example of one such error:

    hentry
    Page URL: /category/photography/
    itemtype: http://microformats.org/profile/hentry
    bookmark: http://www….mysite…com/mirrorless-cameras/

    Missing: author
    Missing: entry-title
    Missing: updated

    From what I gathered, this HENTRY should only be output on posts instead of all pages in the theme since pages don’t have ‘author, entry-title, updated’ etc.

    I’m fairly new to wordpress but not new to code in general. What can be done so that ‘hentry’ only outputs on posts?

    Thanks for your help in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Theme Author acosmin

    (@acosmin)

    Hi! I don’t really know where you got that, are you using any WordPress SEO plugins?

    The only “hentry” thing that this theme has is a css class for posts, outputted by WordPress via post_class() (and I can’t change it, it’s included in all the themes that follow basic WP coding guidelines).

    Later Edit: You could implement something like this: https://wordpress.org/ideas/topic/exclude-a-class-from-post_class if it’s really necessary.

    Theme Author acosmin

    (@acosmin)

    You made me curious.. Try adding this in functions.php

    /*  Remove Hentry
    /* ------------------------------------ */
    function remove_hentry( $classes ) {
    	$classes = array_diff($classes, array('hentry'));	
    
    	return $classes;
    }
    add_filter( 'post_class', 'remove_hentry' );

    No SEO plugins. I’m only using Acosmin Ads Widgets, BackUpWordPress, Caldera Forms, and Light Responsive LightBox.

    I’ve included screenshots here in the order of how I see it in Google Webmaster Tools:

    01: http://i.imgur.com/qxy4Wmi.jpg
    02: http://i.imgur.com/cbhOvTF.jpg
    03: http://i.imgur.com/Eosb59l.jpg

    I would prefer not to completely filter out the tag. It seems like useful markup for posts. The problem seems to be that it also outputs empty microdata markup on ‘pages’ such as taxonomy pages and others which have none of the aforementioned data associated.

    I’ll provide the domain through your contact form on your web site if that helps.

    Theme Author acosmin

    (@acosmin)

    Do these errors appear with other WP themes? I coded this theme with the guidelines in mind, Twenty Fourteen has almost the same structure and it’s the default theme.

    I don’t know what to say, what would you like to remove?

    I will experiment and report back. For now, how can I filter/remove Hentry tag via functions.php for everything EXCEPT Posts?

    Theme Author acosmin

    (@acosmin)

    Maybe something like:

    /*  Remove Hentry
    /* ------------------------------------ */
    function remove_hentry( $classes ) {
    	if( !is_single() ) {
    		$classes = array_diff($classes, array('hentry'));
    		return $classes;
    	} else {
    		return $classes;
    	}
    }
    add_filter( 'post_class', 'remove_hentry' );

    Thank you, that’s what I was looking for. That code ‘works’. It works in that it makes the problem go away in Google Webmaster Tools. Interestingly, it works when I put it at the end of the function.php file after other things have been executed and not when I add it towards the top of the functions.php file.

    I also found this code in another thread dealing with this problem:

    //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 .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><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_suf_hatom_data');

    Here’s the thread where I found it:

    https://wordpress.org/support/topic/how-to-fix-warning-missing-required-field-entry-title-in-rich-snippet-tool

    Again, thanks for making this problem go away. Really appreciate the quick response.

    Theme Author acosmin

    (@acosmin)

    No problem. I’m glad it worked.

    where abouts would I insert this code? I put it after everything in the functions.php and nothing has happened. does webmaster tools take a few days to recognize the change?

    If you want to see the instant results you should try the Structured Data Testing Tool provided by Google.
    Yes, the webmaster tools takes some time (days) to process the changes.

    I wonder why everyone recommends removing the hentry code. I was using Avada theme, but found a valid solution and a fix to provide the hentry data like author name, posted date, laste updated date etc.. and remove the errors in Google Search Console (webmater tool).

    The solution for Hentry issue is by adding the rich data snippets to each and every page that gives a listing of the posts (like search listing, author page, posts by month, blogs by category etc..) and on the post detail page.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Google Webmaster Tools Structured Data Microformat/Microdata (hentry) errors’ is closed to new replies.