Thank you Jeremy,
I do think that I’m not explaining very well.
What I see is that in the schema validator there are two tags added by your Local Seo module one for “logo” and another for the “image”, but for both tags the output is the same refferring to the logo loaded in your module.
You can check what I mean on this image, @id, url and content URL are all referring to the logo.
https://drive.google.com/file/d/1t89h5I1Za8N0ODqc9CzJFZ9nbcOJkopk/view?usp=share_link
The full code and schema overview is on this other link:
https://validator.schema.org/#url=https%3A%2F%2Falmunutri.com%2F
I want that the image schema markup comes out with @id https://mywebsite.com/#image, and with the URLs of my main image of the page (which is of course not the same of the logo).
This I find out that is important to ensure that Google display the image on search results mobile page, due to the fact that my previous version of the schema (one that i made manually by coding it) did have the right tag and did show the image.
Than you for your support.
Kind regards,
Antonio
Hello,
In that case, you may refer to this filter code instead:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if((is_front_page() || is_home()) && isset($data['publisher'])){
$data['publisher']['logo'] = [
'@type' => 'ImageObject',
'@id' => 'https://mysite.com/#image',
'url' => 'https://mysite.com/myimage.png',
'contentUrl' => 'https://mysite.com/myimage.png',
'caption' => 'My image name',
'inLanguage' => 'es',
'width' => 600,
'heght' => 500
];
}
return $data;
}, 99, 2);
This should allow you to change the logo property in the schema and it will only be applied to your homepage.
You would need to change the properties @id and the url accordingly.
Let us know if this helps you with your concern.
Looking forward to helping you.
Thank you Jeremy,
I think we re close but still it shouldn’t work properly because is replacing the logo schema too. (remember the Local SEO of RankMath create both a logo and an image schema markup)
I think the solution will be directly to not input the URL of the logo image in the Local SEO panel and create a custom filter that simply add both the logo and image schema.
It this possible?
For sure you should be thinking of adding the opportunity to insert the image URL directly in the Local SEO too because it’s important and for sure many people miss value on this.
Thank you Jeremy,
I think we re close but still it shouldn’t work properly because is replacing the logo schema too. (remember the Local SEO of RankMath create both a logo and an image schema markup)
I think the solution will be directly to not input the URL of the logo image in the Local SEO panel and create a custom filter that simply add both the logo and image schema.
It this possible?
For sure you should be thinking of adding the opportunity to insert the image URL directly in the Local SEO too because it’s important and for sure many people miss value on this.
Hello,
Are you able to share an example of the schema and how you want it to look like? You may share a screenshot or you can type them here.
The filter I shared should fully modify the entire schema on the fly to your liking.
This property will change the Logo property: $data['publisher']['logo'].
This on the other hand will change the image property: $data['publisher']['image'].
Looking forward to helping you.
Yes this is correct and works nicely!
Hello,
We are super happy that this resolved your issue.
If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.