2

When the button on my website is pressed, I want the link of my website to be shared on LinkedIn. But when the button is pressed, the image I specified in the meta tags does not appear on the share page. In addition, the description and title information I gave in the meta tags are visible.(I am using vite-11ty.)

the link i gave to the button <a href="https://www.linkedin.com/shareArticle?url=website-url/&title=TITLE&summary=SUMMARY"> Share with Linkedin</a>

my meta tags

<meta name="image" property="og:image"content="image-url"/>

  • What is the file type of the image? Make sure it is a JPEG or PNG file. – Ashavan Feb 09 '23 at 16:58
  • The files I used are in png and jpg format. – furkanerkaya Feb 10 '23 at 06:22
  • I'm running into the same issue. I'll link 2 examples below. The first one correctly uses the image specified in og:image. The second does not. I'm not sure what the difference is. https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.codecademy.com%2Fresources%2Fblog%2Ftech-books-by-black-authors%2F https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.codecademy.com%2Fresources%2Fblog%2Fhow-to-future-proof-tech-career-by-learning%2F – John Rood Feb 13 '23 at 15:24
  • It appears both links work correctly now...perhaps there was some faulty cache. Any further insights are still appreciated. – John Rood Feb 13 '23 at 15:30
  • Here's one that doesn't work currently. https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.codecademy.com%2Fresources%2Fblog%2Fcool-job-im-the-nfls-football-operations-data-scientist%2F – John Rood Feb 13 '23 at 15:35
  • In that post inspector, for the links I'm testing, it seems like initially the wrong image is chosen, but it gets fixed within 5 minutes or so of initially testing. – John Rood Feb 13 '23 at 15:52
  • It seems like a cache problem as I mentioned in my answer. You can fix it using the Linkedin Post Inspector. If the img has changed for the same url and Linkedin is not getting it correctly you can try to change something in the url in order to make Linkedin consider as a new request – Pedro Rocha Feb 13 '23 at 16:00
  • @PedroRocha yes, I've tried using a query string to change the url. Unfortunately, it doesn't seem to resolve the issue. – John Rood Feb 13 '23 at 17:20
  • Not updating the image even after you inspected the post with Linkedin Post Inspector? Can you show me a link to a post that doesn't work? – Pedro Rocha Feb 13 '23 at 17:25
  • That's correct. Within the post inspector, you can see that the wrong image is being pulled. The issue seems to correct itself after some time. Here's one that's not working currently: https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.codecademy.com%2Fresources%2Fblog%2Fcareer-path-redesign%2F You'll notice that it's pulling the image of the author rather than the image specified with the og:image tag. – John Rood Feb 13 '23 at 19:00
  • It's a matter of time until Linkedin refresh the data it has about the blog. It seems that the Linkedin Post Inspector is working ok. If you need to automatize the process of asking Linkedin to refresh some pages I could help you using python. if not, you only need to enter your url in the Post Inspector. – Pedro Rocha Feb 13 '23 at 22:01
  • It seems that there are two different refreshes. For the links I included above, initially the inspector said that the content had been scraped "a few seconds ago". However, the wrong image continued being displayed for a period of time. So there is the delay in scraping, and then a delay in some process that corrects the parsing of that which has been scraped. I would consider the post inspector to be broken in that it does not indicate why the og:image is not used during that interim time between when the page is scraped and when the correct image is used. – John Rood Feb 13 '23 at 22:33

2 Answers2

1

First of all, one needs to make sure one is following all the requirements:

  1. og: tags

  2. Image requirements

Below will also give one example of how to solve it with WordPress, as the approach might be helpful.

If those don't work, one approach is to reach out directly to LinkedIn's Support.


Requirement 1

With regards to the og: tags, they must exist and this is their correct format:

<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'/>

One can add inside one's <head> tags.


Requirement 2

The image needs to satisfy the following requirements:

  • Max file size: 5 MB

  • Minimum image dimensions: 1200 (w) x 627 (h) pixels

  • Recommended ratio: 1.91:1

If the image meets the requirements, but it still does not appear in updates on LinkedIn, one's website may be blocking LinkedIn from pulling the image or the image may be located on a protected directory or website.


How to solve it in WordPress?

In WordPress one can solve this issue by using YoastSEO.

The hyperlink above redirects one to a page on how to do it using Facebook, however, as LinkedIn also uses Open Graph metadata, the data used in the Facebook preview is also what LinkedIn will use.

In order to set up an Open Graph image for individual posts and pages, with Yoast SEO,

you can do that in the Social tab of the Yoast SEO meta box, which can be found bellow the page content

(as seen on the image bellow):

enter image description here


Notes:

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
  • 1
    Thanks for the thorough explanation. In my case, it seems that the requirements are met because the correct image usually shows after a period of time. There just seems to be an initial period (perhaps several hours) when the image is not found in the post inspector, despite the fact that it has been recently scraped. I have a very long thread open with LinkedIn support about it, and I believe at this point that it is an internal bug with LinkedIn. – John Rood Feb 21 '23 at 15:51
0

Maybe Linkedin cache isn't up to date with your website. You can try using the LinkedIn Post Inspector to see if the info you gave in the meta tags is being returned ok by Linkedin, it'll make Linkedin refresh the data they've about your post too.

If it doesn't work, try the process mentioned in this post (add a query string in the img url so Linkedin will consider it as a new img).

Also, make sure the URL in the og:image tag is public and the right format (jpg or png)

Pedro Rocha
  • 1,373
  • 1
  • 3
  • 14
  • In my case, a different image from the page (not what is specified via og:image) still displays in the post inspector for a period of time, even after using a query string. The post inspector doesn't give an explanation for why the og:image isn't being used during that period. – John Rood Feb 13 '23 at 23:14