LinkedIn not picking up og:image
Asked Answered
S

13

28

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.

Senility answered 21/4, 2015 at 10:5 Comment(5)
Maybe if you provided the URL for your website we might gain greater insight?Ehrman
Sorry totally forgot a link: personato.nl/vacatures/logistiek/details/logistiek/…Senility
Try following the solution described in the link you posted (there are a lot of errors in your HTML)Ehrman
I can see you managed to do this. I've got the same problem right now... What helped you?Zippora
I have solved this by putting all <meta> tags inside <head> tag. See this answer.Valvate
B
86

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

Benniebenning answered 23/8, 2018 at 15:50 Comment(4)
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.Derbyshire
They should seriously keep this in the official documentation at an easy to find location. Thanks man!Lightfoot
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.Insalivate
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.Royston
S
7

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

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

Spinose answered 1/3, 2021 at 13:34 Comment(1)
this totally fixed it. Should be accepted answerLoftus
B
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.

Brandon answered 24/8, 2016 at 2:52 Comment(2)
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 sameAdapa
same problem here, my og:url is a different base than the image url, never picks up by linkedinSavick
D
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

Demicanton answered 21/8, 2019 at 18:11 Comment(2)
How did you fix that?Eastwards
@Eastwards I'm using RankMathDemicanton
M
3

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

Mafalda answered 10/3, 2018 at 8:0 Comment(1)
Thank you! I added ?linkedin=0 and it finally scraped the OGP metadata properly.Ormazd
U
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/

Unwieldy answered 21/4, 2015 at 10:24 Comment(3)
Yes it does. The og:image meta tag is: <meta property="og:image" content="personato.nl/bestanden/relaties/logos/1/c/…" />Senility
Do you have a caching solution in place?Unwieldy
No we don't use any special form of cache that should be the problem here. Not server side or software sideSenility
L
2

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

Lauzon answered 21/3, 2022 at 22:2 Comment(0)
T
2

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

Tonnie answered 6/2, 2023 at 19:46 Comment(0)
L
1

Try to 1000x425 image. It works for me.

Lindstrom answered 1/8, 2016 at 16:53 Comment(0)
V
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 !!

Vitriol answered 24/4, 2020 at 9:36 Comment(0)
Y
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.

Yeaton answered 14/3, 2022 at 14:59 Comment(0)
D
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
Dedededen answered 30/11, 2022 at 13:7 Comment(0)
H
0

For me the problem was a missing slash ('/') between domain and url parameters.

This worked:

<meta property="og:image" content="https://images.example.com/?uid=...&width=...&height=.."/>

This failed:

<meta property="og:image" content="https://images.example.com?uid=...&width=...&height=.."/>
Herat answered 19/2 at 13:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.