Home » Php » php – LinkedIn not picking up og:image

php – LinkedIn not picking up og:image

Posted by: admin July 12, 2020 Leave a comment

Questions:

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.

How to&Answers:

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

Answer:

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.

Answer:

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

Answer:

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

Answer:

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/

Answer:

Try to 1000×425 image. It works for me.

Answer:

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 scrapping.

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 !!