Community Forums › Forums › Archived Forums › General Discussion › Rich Snippet Strangeness
Tagged: google, google webmaster, ref=, snippets, warning
- This topic has 15 replies, 8 voices, and was last updated 11 years, 5 months ago by Stacey.
-
AuthorPosts
-
December 19, 2012 at 3:10 pm #6254RoadturnParticipant
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?
December 22, 2012 at 2:16 pm #7021nickthegeekMemberYou can include full support via code like this
December 22, 2012 at 5:36 pm #7063RoadturnParticipantThank 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;
}
}December 22, 2012 at 5:45 pm #7064nickthegeekMemberPut 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.
December 22, 2012 at 5:58 pm #7066RoadturnParticipantAt 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>· (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.
December 22, 2012 at 8:11 pm #7082nickthegeekMemberYes, at the end of the file make a new line then paste the entire gist.
January 9, 2013 at 7:57 am #10660mariafernandezMemberNick,
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?
March 1, 2013 at 9:03 am #23516walidmrealtorMemberHow 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/March 14, 2013 at 8:36 pm #26941joycegraceParticipantHi, 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)
March 15, 2013 at 12:07 pm #27190MarcoMemberMarch 15, 2013 at 1:34 pm #27206Bill MurrayMember@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: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
March 16, 2013 at 4:06 pm #28327joycegraceParticipantHi 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)
March 16, 2013 at 9:33 pm #28432Bill MurrayMember@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:
add_filter('wpseo_locale', 'wpp_override_og_locale'); function wpp_override_og_locale($locale) { return "en_CA"; }
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: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
March 21, 2013 at 1:55 am #29876joycegraceParticipantHello 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)
March 21, 2013 at 8:28 am #29942Bill MurrayMember@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: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
April 7, 2013 at 11:52 pm #33907StaceyParticipantBill, the function you've provided to change the locale if using WordPress SEO will work, but only if using a valid Facebook Locale. en_CA is not one. For a list of Facebook Locales, refer to:
https://www.facebook.com/translations/FacebookLocales.xml
Facebook doesn't have one for Canadian English, so en_US is used.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.