Google structuring tool error:image and author:
-
hi…
Today just left the error for Google
My URL is:
for googlefor: ‘https://www.tcpawn.tw/6112’
and
for googleall Error image and author.
https://www.ads-software.com/plugins/yet-another-stars-rating/
-
Hi, yes you’re right, I’ve already fixed the error for the author (will be avaible in yasr 0.9.6), for the image instead I should work for another solution.
Best,
DarioThank you
Upgraded yasr 0.9.6
is Ok.
pppdogHello. Version 0.9.7 I have this problem too.
I’m fix it himself.
Find
– /wp-content/plugins/yet-another-stars-rating/lib/yasr-functions.php
Find: BlogPosting (in 2 places). Change “BlogPosting” on “Article”
Add after schema tag:'<img itemprop="image" src="' . wp_get_attachment_url(get_post_thumbnail_id()) . '" style="width:120px; float:left;border-radius: 20px;margin:10px;">'
Examples place: // First. 313 line - change original on $title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"https://schema.org/Article\"> " . '<img itemprop="image" src="' . wp_get_attachment_url(get_post_thumbnail_id()) . '" style="width:120px; float:left;border-radius: 20px;margin:10px;">' . " <span itemprop=\"name headline\"> ". get_the_title() ." </span>"; // Second. 368 line - change original on $div_1 = "<div class=\"yasr_schema\" itemscope itemType=\"https://schema.org/Article\">" . '<img itemprop="image" src="' . wp_get_attachment_url(get_post_thumbnail_id()) . '" style="width:120px; float:left;border-radius: 20px;margin:10px;">' . "<span itemprop=\"name headline\">". get_the_title() ."</span>";
All working fine: My article
https://russianvisa.me/en/private/welcome-to-visa-to-russia-blogGoogle structured testing tool
https://developers.google.com/structured-data/testing-tool?url=https%253A%252F%252Frussianvisa.me%252Fen%252Fprivate%252Fwelcome-to-visa-to-russia-blogTo Dudo.
Thanks for plugin. Please add my fix to repos. Please add JSON-LD format. It’s simple and clean format. It’s not need layout machine reading text on site.HI gwartur, thank you for using yasr.
Honestly I think that putting an image is too much intrusive for my plugin. People is disliking the simple sentence too.
Instead, I didn’t know json-ld and I think it’s AMAZING. I’ll insert it asap, thank you!
Best,
DarioFrom version 0.9.8 yasr swiched from microdata to json-ld ??
Dudo. All working fine without any fix from my side!!! Super job!
Hi gwartur, just to let you know that from version 0.9.9 it’s possible to choose between microdata and json-ld
Until json-ld is not fully dupported by google (item Review and AgreggateRating aren’t yet) microdata is the default one (you can change in the settings)
As soon as json-ld will be fully supported, it will become the only format used by yasr.
Best,
DarioHi Dario,
a few weeks ago i fix it myself with the errors about the image and Google Structured Data with the microdata.
Maybe you are interested in the code? If so then i would mail it to you. I just get the first image in a post/page and take this one with the resolution 40×40 and it is shown under the average-rating. Take a look here:
https://www.all4hardware4u.de/platinenherstellung/platine-aetzen/aetzgeraet-selber-bauen/If there isn’t any image in the page/post i have a fallback with an “no-image-available”-image and everything is fine with Google;)
The code is like this and its put in the yasr-functions.php:
$attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image') ); foreach ( $attachments as $attachment_id => $attachment ) { $bild=array(wp_get_attachment_image($attachment_id)); } if(!empty($bild[0])) { $bild_neu=$bild[0]; $tag_h1 = 'height="'; $tag_h2 = '" '; $bild_neu = preg_replace("#".$tag_h1.".*".$tag_h2."#Uis", "", $bild_neu); $tag_w1 = 'width="'; $tag_w2 = '"'; $bild_neu = preg_replace("#".$tag_w1.".*".$tag_w2."#Uis", 'width="130"', $bild_neu); $anfang = '<img itemprop="image" width="40" height="40" '; $src = substr($bild_neu,(strpos($bild_neu, 'src="')+5), ((strpos($bild_neu, '" class'))-(strpos($bild_neu, 'src="')+5))); $endung = substr($src, -4, 4); $src = substr($src, 0, -4); $pos = strripos($src, '-'); $laenge = strlen($src); $src = substr($src, -$laenge, $pos); #!!!!! $src = $src.'-40x40'; $src_ohne = str_replace('https://www.all4hardware4u.de','.',$src); $quelle = $src_ohne.$endung; $src='src="'.$src.$endung.'" '; $class = 'class="attachment-thumbnail" '; $alt = substr($bild_neu,(strpos($bild_neu, 'alt="')+5), ((strpos($bild_neu, '" />'))-(strpos($bild_neu, 'alt="')+5))); $alt = 'alt="'.$alt.'"'; $ende = ' />'; $bild_neu2=$anfang.$src.$class.$alt.$ende; if(!file_exists($quelle)) { $bild_neu2=$bild_neu; } unset($bild[0]); } else { $bild_neu2='<img itemprop="image" width="40" height="40" class="attachment-thumbnail" alt="no image" src="https://www.all4hardware4u.de/wp-content/themes/aggregate/images/no_image-40x40.png" />'; }
Best regards,
HarryHi Harry, THANK YOU for sharing this!
Like I said to gwartur, I think that put an image (even if little) at the end of the post is too much intrusive for my plugin.
When json-ld will be fully supported this error will disappear ??Best,
Dario2 Dudo.
You can add functionality with images as an option. Everything is very simple!
1) was added to the administration panel option
“add images” (removes an error in the structured data testing tool)2) to add images to the template for my example (the image is turned off!). You can use my style to russianvisa.me I made the text more beautiful. He added line breaks and beautifully stylized image.
3) If there is no picture (Featured Image not specified), it is necessary to use the Site Identity Icon. If the second picture is also empty, you can use the logo WordPress
I think we must somehow do so. What does all that I have written requires a minimum of time. And please add the 4th type except Product, Place, Other (BlogArticle), simply add the Article. By the way I would have renamed the Other on BlogArticle, because OTHER ??? WTF? =). I’m profy and i know about rich snippets, beginners should just say “do not touch it”
Hey Dario,
i think it can be placed in your code after the line 381 in the yasr-functions.php. Only the two paths need to be adjusted like
$src_ohne = str_replace(home_url(),'.',$src);
and for theno_image-40x40.png
or whatever you want as Fallback-Image to the plugin url/img.And (the old) line 387 has to be changed from
$end_div_1 = "</div>";
to$end_div_1 = "<meta itemprop=\"datePublished\" content=\"".get_the_time('c')."\" /><br />" . __('in the article: ', 'yet-another-stars-rating') . "<span itemprop=\"headline\">".get_the_title()."</span><br />".$bild_neu2."</div>";
Of course, the variable names sound a little German:) You can rename them:)
That’s all:)
The line numbers for the Pro Version are of course a litte bit different;)
Best regards,
HarryThank you both, now I’m very focused on developing the new Yasr website, as soon as I’ll finish it, I’ll consider to make some changes! (always if in the meantime json-ld is still not fully supported ?? )
Have a nice day!
DarioHey Dario,
yes the option to choose Article instead of “other” would be nice:) I have always to change the code manually for Article;)
@gwartur
I have a question to your point 3). Is it necessary to take the the site icon / WordPress logo or is it ok with a “no-image-available”-image like i did, for example here:
https://www.all4hardware4u.de/elektronik-news/internet-things-ohne-sicherheit/Best regards,
HarryI have a question to your point 3). Is it necessary to take the the site icon / WordPress logo or is it ok with a “no-image-available”-image like i did, for example here:
https://www.all4hardware4u.de/elektronik-news/internet-things-ohne-sicherheit/Best regards,
HarryFor google it’s the same, but put the site logo or (if not avaible) the wordpress logo it’s more elegant.
Best,
Dario@harry Milatz
I do not think it’s right to make an image plug “no image”. Let people know best what is something written on WordPress (blog platform) – it increases confidence
- The topic ‘Google structuring tool error:image and author:’ is closed to new replies.