Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linkedin show 3 different image when sharing

Linkedin show different 3 image when trying to share. Here is then head tags

<meta property="og:site_name" content="OkyTalk">
<meta property="og:title" content="OkyTalk ">
<meta property="og:type" content="website">
<meta property="og:url" content="https://okytalk.com/teachers/profile/displayProffesional">
<meta property="og:image" content="https://okytalk.com/media/okytalk/img/share.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="470">
<meta property="og:image:height" content="246">

enter image description here

Any Ideas how to show only one ? Others share(facebook, twitter, google+) works fine.

like image 735
Remis Pew Avatar asked Oct 31 '22 04:10

Remis Pew


2 Answers

Things certainly have changed since 2015! For instance, the entire company of LinkedIn has been bought by Microsoft, and almost all the old documentation for LinkedIn on LinkedIn.com just 404's. I'm going to post in case others still have this problem.

To quote from the Microsoft LinkedIn Share Documentation, you want your share URL actually to be...

https://www.linkedin.com/sharing/share-offsite/?url={url}

Your og: tags appear to be correct, and they should be properly interpreted today, in 2020. It seems that they were only officially supported in 2017, two years after your question. Take a look at the LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn. These should work...

  • <meta property='og:title' content='Title of the article"/>
  • <meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
  • <meta property='og:description' content='Description that will show in the preview"/>
  • <meta property='og:url' content='//www.example.com/URL of the article" />

Don't forget, once you're all coded and done, you can test your page! Take the URL of your site (example.com, not linkedin.com/share?site=example.com), and input it into the LinkedIn Post Inspector.

Here's an online demo I created with 20+ share services (100% no monetary income, it is designed as a test site). Take a look at the source code, and see how it's making the LinkedIn URL work with og: tags.

Hope all this info helps someone!

like image 187
HoldOffHunger Avatar answered Nov 12 '22 16:11

HoldOffHunger


LinkedIn are picking up the images in the img tag for some reason unlike Facebook etc.

The workaround is to change the images in the img tags on the page you are sharing to set the images in CSS and change to img tag to a div.

Add a style like:

#howitworksstudent{
  background: url(https://okytalk.com/media/okytalk/img/how-it-works-student.png);
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
}

and change your img tag to:

<div id="howitworksstudent"/>

Not ideal but gets you around the problem. I have tested this and was able to recreate your initial issue so I know it works.

Hope that helps.

like image 21
slarge Avatar answered Nov 12 '22 15:11

slarge