getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[seo-magic] LinkedIn ignores og:image generated by SEO Magic #422

Open matt-j-m opened 4 months ago

matt-j-m commented 4 months ago

As per title LinkedIn ignores the og:image property generated by SEO Magic and instead falls back to an alternate image found within the page. Using the LinkedIn Post Inspector https://www.linkedin.com/post-inspector shows the image selected, and interestingly says the way to change it is to "Provide a metadata tag for the og:image in the page's head section.", which is already present.

I was able to work around this on a page-by-page basis by setting the SEO Magic Meta Image value to "No image", then entering a custom Metadata entry on the Options tab in the page editor. The main difference in the resulting html is that my custom entry has a filename extension (.jpg) whereas the one generated by the plugin does not. It should be noted that the seomagic-image URL successfully resolved when opened in a separate browser window, before I removed it.

Generated by SEO Magic, ignored by LinkedIn: <meta property="og:image" content="https://www.simprogroup.com/seomagic-image" />

Custom Metadata value, respected by LinkedIn: <meta property="og:image" content="https://www.simprogroup.com/user/themes/simpro/images/simpro-generic-preview.jpg" />

Edit: Here is an example which I've not yet applied the work-around to -

Page URL: https://www.simprogroup.com/features/improve-cashflow SEO Magic generated https://www.simprogroup.com/features/improve-cashflow/seomagic-image shows company logo LinkedIn Post Inspector picks up a random icon as the preview image: https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.simprogroup.com%2Ffeatures%2Fimprove-cashflow

rhukster commented 4 months ago

It appears that linkedin doesn't like the image proxy not containing the extension of the file. That's unfortunate as really the file extension should be 100% optional as long as the mime type is set correctly (which it is).

I will look into the feasbility of appending the image file's extension to the image proxy URL..

BTW, the image proxy is required as there are some complex rules for possible image locations, and having a single proxy URL and then actually 'streaming' the image via that proxy-url is the best way to handle this.

rhukster commented 4 months ago

Should be fixed in next release (v5.2.1)

matt-j-m commented 3 months ago

Great, thanks @rhukster. I've just updated and can see the file extension is now added. My original issue with LinkedIn is now solved!

However I've just found something else - the og:image for the homepage is now producing a 500 error. It works fine for other pages. In my local environment html it appears as <meta property="og:image" content="http://localhost/seomagic-image.jpg" />.

The error produced begins with

[2024-03-12 13:29:14] grav.CRITICAL: Call to a member function media() on null

Thanks again

rhukster commented 3 months ago

hmmm... ok sorry about that, will investigate

rhukster commented 3 months ago

Did some quick testing and I can't replicate this 500 error on my local.. using https://sandbox.local/seomagic-image.jpg

Can you please look in your logs/grav.log and paste me the entire strack trace of that "call to undefined function media()..." error