除了这个网站,我有一个 个人博客 哪里, 除其他事项外, 我张贴的食谱. 我最近发现了谷歌的新配方搜索, 并一直在寻找实现对微格式的支持 / 微数据. 谷歌检查你的标记提供一个工具, 叫做 ”丰富喀嚓 - 宠物测试ing工具”. 当我试图验证我的食谱之一, 我遇到的各种错误, which have taken me a while to track down and resolve.
1. 第一个问题是与作者信息 / hrecipe section
该解决方案:
你需要一个谷歌个人资料. 你的谷歌个人资料必须从某处在页面上链接, 使用rel =“我”, 和你的网站的主域名必须在你的谷歌个人资料链接上市.
I achieved this with the Mystique theme with a series of modifications.
首先, 我加入了代码 yoast (如下所示) 添加到functions.php
function yoast_add_google_profile( $contactmethods ) { // Add Google Profiles $contactmethods['google_profile'] = 'Google Profile URL'; return $contactmethods; } add_filter( 'user_contactmethods', 'yoast_add_google_profile', 10, 1);
第二, I went to my wordpress profile page and filled in the google profile field with a link to my google profile
第三, 我编辑一行author.php, 再次, 基于从yoast信息, 但改变的主题Mystique
in this section
if(($curauth->user_url<>'http://') && ($curauth->user_url<>'')) echo ' '.__('Homepage:','mystique').' <a href="'.$curauth->user_url.'">'.$curauth->user_url.'</a> '; if($curauth->yim<>'') echo ' '.__('Yahoo Messenger:','mystique').' <a href="ymsgr:sendIM?'.$curauth->yim.'">'.$curauth->yim.'</a> '; if($curauth->jabber<>'') echo ' '.__('Jabber/GTalk:','mystique').' <a href="gtalk:chat?jid='.$curauth->jabber.'">'.$curauth->jabber.'</a> '; if($curauth->aim<>'') echo ' '.__('AIM:','mystique').' <a href="aim:goIM?screenname='.$curauth->aim.'">'.$curauth->aim.'</a> ';
add this extra line
if(($curauth->user_url<>'http://') && ($curauth->user_url<>'')) echo ' '.__('Homepage:','mystique').' <a href="'.$curauth->user_url.'">'.$curauth->user_url.'</a> '; if($curauth->yim<>'') echo ' '.__('Yahoo Messenger:','mystique').' <a href="ymsgr:sendIM?'.$curauth->yim.'">'.$curauth->yim.'</a> '; if($curauth->jabber<>'') echo ' '.__('Jabber/GTalk:','mystique').' <a href="gtalk:chat?jid='.$curauth->jabber.'">'.$curauth->jabber.'</a> '; if($curauth->aim<>'') echo ' '.__('AIM:','mystique').' <a href="aim:goIM?screenname='.$curauth->aim.'">'.$curauth->aim.'</a> '; if($curauth->google_profile<>'') echo ' <a href="' . $curauth->google_profile . '" rel="me">Google Profile</a> ';
下一个, I edited single.php to add rel=“author” to the link to my author page. In the Mystique theme this is found towards the bottom of the file, within the (long) 线(s) 如下所示. I have added the rel=“author” at the end of the first line before the href=” part
printf(__('This entry was posted by %1$s on %2$s at %3$s, and is filed under %4$s. Follow any responses to this post through %5$s.', 'mystique'), '<a title="'. sprintf(__(" href="'. get_author_posts_url(get_the_author_meta('ID')) .'" rel="author">'. get_the_author() .'</a>', get_the_time(get_option('date_format')),get_the_time(get_option('time_format')), get_the_category_list(', '), '<a title="RSS 2.0" href="'.get_post_comments_feed_link($post->ID).'">RSS 2.0</a>');echo ' ';
然后, finally add the same rel=“author” to line 670 of core.php
如果正确实施,你应该得到的摘要测试工具,它读取成功消息 验证: 著作权标记是这个页面正确
2. 第二个问题(s) 均与hfeed / hentry section and included the following:
小姐-ING需要的hCard“作者”.
警告,ing: 至少一个字段必须为hCard的设置.
警告,ing: 至少一个字段必须为HatomEntry设置.
警告,ing: 小姐-ING必填字段“入门称号”.
警告,ing: 小姐-ING必填字段“更新”.
警告,ing: 小姐-ING需要的hCard“作者”.
解决方案(s):
使用WordPress的编辑器编辑的single.php
查找代码
</pre> <h1 class="title"></h1> <pre>
与替换此...
</pre> <h1 class="title entry-title"></h1> <h2 class="updated"></h2> <h2 class="vcard"></h2> <pre>
最后要注意 - 不要只从本页面复制和粘贴代码, 如因某种原因 (我猜的字符编码) 它不会工作. 从这里复制并粘贴到Windows记事本. 然后从Windows记事本重新复制 (或任何其他基本的纯文本编辑器只) 并粘贴到WordPress的编辑器. 通过记事本打算失去任何隐藏的编码或导致这样的代码被作为纯文本处理的问题被认为是其他数据
发现这个有用? 请不要让我们知道通过下降到低于评论. 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.
发表评论