Wrong image displayed by LinkedIn Open Graph

走远了吗. 提交于 2019-12-01 23:53:07

LinkedIn (shockingly and sadly!) only use official partners from http://embed.ly/providers for 'projects' on your profile. Open Graph only works on the LinkedIn feed/sharing updates area.

Otherwise, you can upload an assortment of filetypes to feature, but no way to explicitly to tell LinkedIn which image to use on the profile.

Embed.ly does pick up open graph information on your site, but they don't prioritize the OG information. In fact, Embed.ly wrote a blog post that essentially scoffs at the widespread use of Open Graph tags for sharing and how users and large websites supposedly can't trust them.

EDIT:

To answer the comment:

You can reshuffle things on embed.ly, for example, by disabling your background-image while you add your website to your profile, or switching your background-image to the desired one just long enough for you to get the desired effect on LinkedIn. This isn't a guaranteed fix as LinkedIn may recache the project at a later (any!) time which will set it back to your background-image.

This just happened to me, and the reason was that the filename of the image in the og:image tag had accented Unicode characters in it (e.g., á, é). LinkedIn must skip over filenames with those characters, because it was choosing another image on the page instead.

I changed the image filename to one without Unicode characters and it pulled in the correct image.

LinkedIn can take the image from tag named 'oEmbed' despite og:image tag exists.

Here an exapmle:

<link rel="alternate" type="application/json+oembed" href="https://www.s-sols.com/api/oembed/1.0/embed?url=https%3A%2F%2Fwww.s-sols.com%2Fhow-make-multipage-website">
And this JSON content contains ordinary image.

I faced with that problem in WordPress. The cure was to remove this tag as described here:

remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
remove_action('wp_head', 'wp_oembed_add_host_js');
remove_action('rest_api_init', 'wp_oembed_register_route');
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!