25

For one of my websites I am using Open Graph to enrich posts shared from my website. But LinkedIn is not picking the image specified in og:image. The image is modified for the LinkedIn bot to be 200px X 200px by a simple PHP script.

I found some experiencing a similar problem (Linkedin not getting thumbnail image) but this problem is not yet solved.

Kermit
  • 4,922
  • 4
  • 42
  • 74
Rik Morskate
  • 251
  • 1
  • 3
  • 5
  • Maybe if you provided the URL for your website we might gain greater insight? – symcbean Apr 21 '15 at 10:15
  • Sorry totally forgot a link: http://personato.nl/vacatures/logistiek/details/logistiek/operations-manager-vas-seacon-logistics-brand-loyalty/PEML15959 – Rik Morskate Apr 21 '15 at 10:20
  • Try following the solution described in the link you posted (there are a lot of errors in your HTML) – symcbean Apr 21 '15 at 10:25
  • 1
    I can see you managed to do this. I've got the same problem right now... What helped you? – Golyo Dec 16 '16 at 09:59
  • 1
    I have solved this by putting all `` tags inside `` tag. See this [answer](https://stackoverflow.com/a/53300213/2884309). – Ivan Aracki Nov 14 '18 at 12:26

12 Answers12

80

I know it's old but this helped.

Linkedin caches link preview content for 7 days. You have to do the following to clear Linkedin Preview cache:

Step 1: Visit https://www.linkedin.com/post-inspector/inspect/

Step 2: Enter your url and click on Inspect, You will see the updated preview image

Step 3: Now try sharing your url on Linkedin

Adriana
  • 1,002
  • 9
  • 17
  • 2
    Great and thanks, however, you should tell people they need to refresh the page to actually see that LinkedIn picks up the changes. I did your trick, Added my website link inside a LinkedIn comment, only to be horrified because I did not see the change, even after I did the "INSPECT". Most probably, LinkedIn picks up the "og" image on the frontend, not the backend. – georgesjeandenis Mar 04 '19 at 07:24
  • 2
    They should seriously keep this in the official documentation at an easy to find location. Thanks man! – Jacob Celestine Aug 20 '20 at 13:39
  • 6
    I know this is old, but Linkedin does not support webp images for those who may be having trouble. It's unfortunate, but using a png solved my issues. – ChekTek Jun 09 '21 at 15:16
  • 4
    Doesn't work for me... Am I the only one? Source code clearly shows og:image but the post inspector is picking up the image from the site's homepage. – Jules Colle Aug 31 '21 at 14:30
6

You might need to check linkedin post cache and refresh it for a specific link.

https://www.linkedin.com/post-inspector/

Numan Karaaslan
  • 1,365
  • 1
  • 17
  • 25
5

This question is a bit old but I ran into the same situation and got it solved so I just post my solution( or my understanding how it work) for others have the same problem.

(Thank you for @Justin Kominar, his answer in this question helps me.)

  1. Make sure you have prefix="og: http://ogp.me/ns# in your tag, when you have iframe(s), make sure which page is calling the share function.
  2. Make sure you set all four <meta> tags in you site and give the correct type to <meta property="og:type> (please go to ogp.me for more information)
  3. Make sure you pass the correct url(the one you want to share, eg.https://news.com/this_news) to <meta property="og:url> especially when you use dynamic url
  4. In the page you pass to og:url ( it is very important to understand linkedin will go to this page to look for the information not the page you call the share function, most of the time they are the same but sometimes that is not the case), you need to do step 1 and 2, set <meta og:image> AND MAKE SURE THE IMAGE LINK IS VALID AND THE IMAGE DOES EXIST

Hope it will help.

Community
  • 1
  • 1
Baoyun Chen
  • 281
  • 1
  • 5
  • 17
  • 1
    What if in 3, page being shared and od:url content attribute value are the same, anything to consider? I have tested with prefix and without, and it does not take the image. Twiter, telegram, whatsapp work, but not linkedIn. even compare a Medium page tags with mine, and looks pretty the same – Ricker Silva Dec 21 '16 at 16:50
  • 2
    same problem here, my og:url is a different base than the image url, never picks up by linkedin – Ayyash Mar 06 '20 at 06:16
5

I faced with wrong image choosing by LinkedIn in my WordPress site. I found the problem by discovering URL by LinkedIn post inspector and saw that oEmbed tag was used dispite og:image tag is existed:

enter image description here

2

Does your code look like this?

<html prefix="og: http://ogp.me/ns#">
<head>
  <meta property="og:title" content="My Shared Article Title" />
  <meta property="og:description" content="Description of shared article" />
  <meta property="og:url" content="http://example.com/my_article.html" />
  <meta property="og:image" content="http://example.com/foo.jpg" />
</head>
<body>
   …
</body>
</html>

Also, check the documentation here:

https://developer.linkedin.com/docs/share-on-linkedin

Also, check your URL with Facebook Linter (it works with all OG tags):

https://developers.facebook.com/tools/debug/

Ciprian
  • 872
  • 1
  • 10
  • 30
2

Adding a garbage parameter at the end of my link, helped me force linkedin to get og:image again.

I found my solution on this post

Rahul Makhija
  • 381
  • 4
  • 7
2

Per @checkTek's comment, LinkedIn does not support .webp images for the og:image property.

Dan
  • 744
  • 1
  • 8
  • 23
1

Try to 1000x425 image. It works for me.

jrosell
  • 1,445
  • 14
  • 20
1

This answer is for the people who tried all the methods described in the above answers and still got no luck !!

I had this scenario and I fixed it by renaming the og:image.

I believe image with long name can trick the linkdin to prevent the image from scraping.

before the tag was

<meta property="og:image" name="image" content="images/meta-this-is-a-very-long-name.jpg">

I fixed this issue by renaming it to a smaller name.

<meta property="og:image" name="image" content="images/meta-image.jpg">

voila.. it worked !!

Jinu Kurian
  • 9,128
  • 3
  • 27
  • 35
1

Warning - i'm using JavaScript

Check step

First of all, you have to check if your website/blog have all the meta tags correctly puted on tag of your HTML document. You can do this by just puting your website link on https://developers.facebook.com/tools/debug and debugging.

But if you just get the wrong image no matter what on Linkedin post inspector but not on Facebook debugger (both use open graph tags) the problem is the Linkedin. So if this you can continue here.

My problem and the solution

I have my images on AWS, so i use 2 different links, one is for the service, the other is the link of the image.

The problem with Linkedin, is that he cannot read two URLs. So you have to encode properly.

My service is somenthing like this

https://d1muf25xaso8hp.cloudfront.net/[IMAGE_URL]?options

Now, you gonna see an example. I have a function that just get this two together. Take a look:

Example:

// The service - 
https://d1muf25xaso8hp.cloudfront.net/[IMAGE_URL]?options

// Function Input - 
https://s3.amazonaws.com/appforest_uf/imageID/200x200.png

// Function Output - 
https://d1muf25xaso8hp.cloudfront.net/https%3A%2F%2Fs3.amazonaws.com%2Fappforest_uf%2Ff1643682361025x516549218825449500%2F200x200.png?w=&h=&auto=compress&dpr=1&fit=max

The function

const resizeS3Image = (s3_url) => {
  let s3_clean_url = s3_url;
  s3_clean_url = s3_clean_url.replace(/\//g, '%2F').replace(/\:/, '%3A');
  const cloudFrontCompressedImage = `https://d1muf25xaso8hp.cloudfront.net/${s3_clean_url}?w=&h=&auto=compress&dpr=1&fit=max`;
  return cloudFrontCompressedImage;
};
Things you may have notice
  • The second URL (the image) have some things replaced, like the slash ('/') and colon (':'), for the equivalent code on URL encode.

2 - How i did it ? using regex pattern and the .replace native JS constructor.

Tools and references that i used

https://www.w3schools.com/tags/ref_urlencode.asp

Remind to

When you're debuggin again your website on the Linkedin Post inspector, remind to add after the URL somenthing after '?' like https://yourwebsite/post/what-is-lorem-impsum?aaaa=912093090 That way, you gonna update the Linkedin SEO Cache.

1

For me the problem was the image size. Once I increased the size from 300px wide to 1200px wide it worked.

For LinkedIn:

  • The maximum file size allowed is 5MB.
  • The minimum image dimension should be 1200px X 627px.

https://dev.to/samuelorobosa/how-to-handle-linkedin-and-twitter-link-previews-23eg

However, the post inspector was finding smaller images around 750MB. So the true value is somewhere between 300:1200

p.s. gifs work on linkedin but are a single still frame on twitter

Kermit
  • 4,922
  • 4
  • 42
  • 74
0

I was using the LinkedIn Post Inspector and it wasn't finding my image. However, Facebook Debugger was showing it. Both platforms use Open Graph (OG).

In my case, the issue that was causing this to happen were spaces in the original image name (replaced in URL with +)).

This worked:

https://images.mywebsite.com/abc/name_of_image.png?auto=compress,format&rect=0,0,3600,1890&w=1200&h=630

This was failing:

https://images.mywebsite.com/abc/Name+of+Image+-+Test+-+4.png?auto=compress,format&rect=0,0,3600,1890&w=1200&h=630
Leopold Kristjansson
  • 2,246
  • 28
  • 47