Rich Snippet Strangeness

Community Forums Forums General Discussion Rich Snippet Strangeness

This topic is: not resolved

This topic contains 15 replies, has 8 voices, and was last updated by  Stacey C 1 year, 3 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #6254

    Roadturn
    Participant
    Post count: 5

    When I use Google’s Rich Snippet Tool to check my blog, I get the following return:
    Warning: Missing required field “updated”.
    Warning: Missing required hCard “author”

    Advise I have found ranges from “Nothing you can to about it” to major code changes.

    What say the StudioPress masterminds about the situation?

    #7021

    nickthegeek
    Keymaster
    Post count: 751

    You can include full support via code like this

    #7063

    Roadturn
    Participant
    Post count: 5

    Thank you, Nick.

    Do I edit the theme functions directly or use a plugin?

    Also, the current code follows. Where does the new stuff end and how much of the current is replaced?

    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    add_action( ‘genesis_before_post_title’, ‘genesis_post_info’ );

    /** Customize the post info function */
    add_filter( ‘genesis_post_info’, ‘post_info_filter’ );
    function post_info_filter($post_info) {
    if (!is_page()) {
    $post_info = ‘[post_author_posts_link] [post_date]‘;
    return $post_info;
    }
    }

    /** Customize the post meta function */
    add_filter( ‘genesis_post_meta’, ‘post_meta_filter’ );
    function post_meta_filter($post_meta) {
    if (!is_page()) {
    $post_meta = ‘[post_categories] [post_edit] [post_tags] [post_comments]‘;
    return $post_meta;
    }
    }

    #7064

    nickthegeek
    Keymaster
    Post count: 751

    Put it into the functions.php file and that code could exist along side the code you have. Put it at the very end of the file.

    #7066

    Roadturn
    Participant
    Post count: 5

    At the very end of functions.php, I see:

    genesis_register_sidebar( array(
    ‘id’ => ‘portfolio’,
    ‘name’ => __( ‘Portfolio’, ‘balance’ ),
    ‘description’ => __( ‘This is the portfolio page.’, ‘balance’ ),
    ) );

    DO I THEN add the full amount of the gist you sent right here? The gist ends as follows:
    if ( $published_compare < $modified_compare ) {
    echo ‘<span><em>&middot; (Updated: ‘ . $modified . ‘)</em></span>’;
    } ?>
    </div>
    <?php }

    WILL THAT WORK to wrap it all up?

    One more thing … there is going to be duplicate code if I simply add the gist to the end of the file and leave the rest as is.

    Thank you, Nick. I want to be sure I understand before I start messing with the code.

    #7082

    nickthegeek
    Keymaster
    Post count: 751

    Yes, at the end of the file make a new line then paste the entire gist.

    #10660

    mariafernandez
    Participant
    Post count: 18

    Nick,

    I’ve used this code on my blog. Unfortunately, although it has removed the “Warning: Missing required field “updated”.”, it has also added a second ‘By Maria Fernandez” line to all my posts, as well as  “Updated: <date>”. These new lines make my blog unsightly.

    Is there a way I can add code that will remove the Warning without adding the “By <author>” and “Updated” lines?

    #23516

    walidmrealtor
    Participant
    Post count: 3

    How do we remove the double posting of the post meta info?


    There is no Try, Do, or Do Not. ~Master Yoda
    Walid Muhammad | REALTOR® | Broker | http://www.walidmrealtor.com/

    #26941

    joycegrace
    Participant
    Post count: 57

    Hi, I’m also wondering how to get this right. I don’t know if I understood the thread correctly, but it appears that Roadturn had code, and then Nick had code, and you’re supposed to put the two together to the Rich Snippets Testing Tool to not show errors anymore? Or is it that we’re only supposed to use Nick’s code?

    Any help would be greatly appreciated.

    Curious also if Genesis will soon support rich snippets out of the box? That would help so much.


    Find me at Joyce Grace (http://www.joycegrace.ca) and Clicks Online Marketing (clicksonlinemarketing.com).

    #27190

    Marco
    Participant
    Post count: 4

    Nick’s code is also giving a validation error: Warning: Missing required field “updated”.

    Even if you change <span class=”updated”> to <span class=”date updated”>

     


    Where to find me: Facebook | Google + | Twitter | Website

    #27206

    Bill Murray
    Participant
    Post count: 572

    @walidmrealtor – The code in the gist has nothing to do with postmeta. If you’ve added the code to your functions.php as Nick described, post a link to your site where you’re seeing double post meta and post your entire functions.php in a pastebin and post a link back here.

    @joycegrace – Ignore the code from Roadturn. As Nick outlined, copy the entire gist and paste it at the bottom of your child theme’s functions.php. If it’s not working, post your functions.php in a pastebin and post a link back here, along with a link to your site.

    @Marco – Same advice as for joycegrace.


    Web: http://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #28327

    joycegrace
    Participant
    Post count: 57

    Hi it doesn’t appear to be working for me. Other things are also not being picked up, not sure why. For example my locale is not showing as en_CA even though I have Canadian English set up on my blog (it shows as en_US). The authorship is also not working for some reason. Maybe it takes a few days to find all the changes?

    Here is the pastebin: http://pastebin.com/Gyr2zEjD

     


    Find me at Joyce Grace (http://www.joycegrace.ca) and Clicks Online Marketing (clicksonlinemarketing.com).

    #28432

    Bill Murray
    Participant
    Post count: 572

    @joycegrace – It looks like you have WordPress SEO activated and have configured that plugin to add open graph meta (see the SEO->Social menu).

    Therefore, try 1 of 2 things: either 1) remove the checkbox that causes WordPress SEO to add open graph meta or 2) deactivate the plugin. After doing 1 of the above, refresh the page, and see what open graph settings are in your page source.

    If you want to use WordPress SEO, you can consider removing the code snippet you added to functions.php and fix the open graph output of WordPress SEO. The code snippet from this post and WordPress SEO probably won’t play nicely together. For example, here’s one bit of code to fix the locale if you use WordPress SEO:

    [php]
    add_filter(‘wpseo_locale’, ‘wpp_override_og_locale’);
    function wpp_override_og_locale($locale)
    {
    return "en_CA";
    }
    [/php]

    You can find a list of filters supported by WordPress SEO here http://yoast.com/wordpress-seo-api-docs/ to fix each wrong open graph tag.

    Yoast uses the built-in WP function get_locale() (see near line 28 of includes/l10n.php). WP’s function takes your locale from the WPLANG define. If it is not set (likely your case), you end up with a locale of en_US. That’s why your locale is what it is. Instead of adding the above code to your functions.php, you can consider adding this to your wp-config.php:

    define (‘WPLANG’, ‘en_CA’);

    That should fix your locale when using WordPress SEO, but it may have other consequences you don’t like.

    You’d have to fix each of your other open graph issues with similar techniques.

    Hope that helps.


    Web: http://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #29876

    joycegrace
    Participant
    Post count: 57

    Hello Bill, thank you very much for your help, I really appreciate it.

    This may sound like a dumb question but are you saying that schema.org and open graph can’t be used together? Or just that the Yoast open graph in particular causes problems with schema.org markup?

    About the locale, I do have the en_CA defined in my wp-config file, it still doesn’t seem to be ‘catching’ it when I use Google’s rich snippet testing tool :(


    Find me at Joyce Grace (http://www.joycegrace.ca) and Clicks Online Marketing (clicksonlinemarketing.com).

    #29942

    Bill Murray
    Participant
    Post count: 572

    @joycegrace – Schema and Open Graph should work fine together. Your site has some schema markup (just a little…2 lines is all I saw) and some open graph from 2 sources.

    Google is catching what is in your page source. Look at your page source to get a better understanding. If markup is in your page source, Google will see it. If it is not in your page source and you can read the page source to find the OG markup, the Google tool is an unnecessary step. The Google tool is useful if you can’t read the page source or as an extra aid in case you might miss something – that’s all.

    At the top of your page source for your home page, you have some OG markup put there by Yoast. Then, you have some OG markup put there by Facebook Open Graph. Then you have some schema markup put there by Google Plus metatags.

    Your OG markup from both Yoast and Facebook Open Graph is specifying your locale as en_us. (Actually, Yoast uses “en_US” and Facebook outputs “en_us”.) That’s why Google is reporting what it does. Also, note that Yoast has your site type (og:type) as “website” but Facebook has it as “blog”, so Google gets both of those possibly confusing signals.

    Again, before using Google’s tool, just look at your page source. Next, don’t have multiple plugins outputting the same OG markup. It’s inefficient, and there’s a change that they send conflicting messages.

    If you deactivate both plugins, you won’t get an OG locale in your page output. So, I recommend deactivating Facebook Open Graph and trying to fix Yoast’s output. If his plugin output is off, your first step is to try the WP.org support forums for his plugin. If your question gets no love there, you can use the example I gave above to manually reset his OG output using code and filters.


    Web: http://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.