En plus de ce site, j'ai un Blog personnel où, entre autres choses, Je poste des recettes. J'ai récemment découvert une nouvelle recherche de la recette de google, et ont cherché à mettre en œuvre un soutien pour les microformats / microdonnées. Google fournit un outil pour vérifier votre balisage, appelée “outil de test des extraits enrichis“. Quand j'ai essayé de valider une de mes recettes, J'ai rencontré diverses erreurs, qui m'ont pris un certain temps à traquer et résoudre.
1. The first problem was with the author information / section hrecipe
La solution:
You need a google profile. Your google profile must be linked from somewhere on the page, with rel=”moi”, AND the main domain of your website must be listed on your google profile links.
I achieved this with the Mystique theme with a series of modifications.
D'abord, J'ai ajouté le code de Yoast (comme indiqué ci-dessous) à functions.php
[php]fonction yoast_add_google_profile( $contactmethods ) {
// Ajouter Profils Google
$contactmethods[‘google_profile’] = ‘Google Profile URL»;
return $ contactmethods;
}
add_filter( ‘user_contactmethods’, ‘yoast_add_google_profile’, 10, 1);[/php]
Deuxième, I went to my wordpress profile page and filled in the google profile field with a link to my google profile
Troisième, J'ai édité une ligne à author.php, encore, based on information from yoast, but changed for the Mystique theme
dans cette section
[php]
si(($curauth->user_url<>’http://») && ($curauth->user_url<>”)) écho ‘
‘.__(‘Homepage:»,’mystique’).’ <a href="’.$curauth->user_url.’">’.$curauth->user_url '.</une>
»;
si($curauth->Yim<>”) écho ‘
‘.__(‘Yahoo Messenger:»,’mystique’).’ <a href="ymsgr:Sendim?’.$curauth->yim.’">’.$curauth->Yim.</une>
»;
si($curauth->jacasser<>”) écho ‘
‘.__(‘Jabber/GTalk:»,’mystique’).’ <a href="gtalk:bavarder?jid=’.$curauth->jabber.’">’.$curauth->jabber.</une>
»;
si($curauth->objectif<>”) écho ‘
‘.__(‘AIM:»,’mystique’).’ <a href="aim:Gentils?screenname=’.$curauth->aim.’">’.$curauth->viser.</une>
»;
[/php]
ajouter cette ligne supplémentaire
[php highlight=”5″]
si(($curauth->user_url<>’http://») && ($curauth->user_url<>”)) écho ‘
‘.__(‘Homepage:»,’mystique’).’ <a href="’.$curauth->user_url.’">’.$curauth->user_url '.</une>
»;
si($curauth->Yim<>”) écho ‘
‘.__(‘Yahoo Messenger:»,’mystique’).’ <a href="ymsgr:Sendim?’.$curauth->yim.’">’.$curauth->Yim.</une>
»;
si($curauth->jacasser<>”) écho ‘
‘.__(‘Jabber/GTalk:»,’mystique’).’ <a href="gtalk:bavarder?jid=’.$curauth->jabber.’">’.$curauth->jabber.</une>
»;
si($curauth->objectif<>”) écho ‘
‘.__(‘AIM:»,’mystique’).’ <a href="aim:Gentils?screenname=’.$curauth->aim.’">’.$curauth->viser.</une>
»;
si($curauth->google_profile<>”) écho ‘
<a href="’ . $curauth->google_profile . »" rel="me">Google Profil</une>
»;
[/php]
Suivant, I edited single.php to add rel=”auteur” to the link to my author page. In the Mystique theme this is found towards the bottom of the file, à l'intérieur de l' (long) ligne(s) comme indiqué ci-dessous. I have added the rel=”auteur” at the end of the first line before the href=” partie
[php]
printf(__(‘This entry was posted by %1$s on %2$s at %3$s, et est classé dans% 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() .»</une>»,
get_the_time(get_option(‘date_format’)),get_the_time(get_option(‘time_format’)), get_the_category_list(», »), »<un titre ="RSS 2.0" href="’.get_post_comments_feed_link($post->ID).’">RSS 2.0</une>»);écho ‘ »;
[/php]
Puis, finally add the same rel=”auteur” to line 670 de core.php
When this is correctly implemented you should get a success message in the snippets testing tool which reads Verified: Authorship markup is correct for this page
2. Le deuxième problème(s) étaient à la hfeed / hentry section and included the following:
C'est un article très utile “auteur”.
Attention: Au moins un champ doit être défini pour Hcard.
Attention: Au moins un champ doit être réglé pour HatomEntry.
Attention: Manquant champ obligatoire “entrée-titre”.
Attention: Manquant champ obligatoire “mise à jour”.
Attention: C'est un article très utile “auteur”.
La solution(s):
Use the wordpress editor to edit single.php
Trouvez le code
[xhtml]</pré>
<h1 class="title"></h1>
<pré>
[/xhtml]
replace this with…
[xhtml]</pré>
<h1 class="title entry-title"></h1>
<h2 class="updated"></h2>
<h2 class="vcard"></h2>
<pré>
[/xhtml]
A final note – Don’t just copy and paste the code from this page, que pour une raison quelconque, (I’m guessing character encoding) il l'habitude de travail. Copy it from here and paste into windows notepad. Then re-copy it from windows notepad (ou toute autre base de texte brut seule éditeur) and paste into the wordpress editor. Going via notepad loses any hidden encoding or other data which causes a problem so the code is treated as the plain-text it is supposed to be
S'il vous plaît envoyez-nous vos pensées en commentant ci-dessous! Si vous souhaitez vous abonner s'il vous plaît utiliser le lien d'abonnement dans le menu en haut à droite. Vous pouvez également partager avec vos amis en utilisant les liens sociaux ci-dessous. À votre santé.
Laisser un commentaire