1

When sharing an article hosted on LinkedIn, the og:image URL expires after a certain time (I think 24 hours). Is there a direct URL to call in order to get an always up-to-date og:image?

For an internal work resource, I pull og:image to use as featured images for a site built on Wordpress that links out to the LinkedIn URL.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
gvjonjones
  • 90
  • 2
  • 8

1 Answers1

1

To quote the official documentation, LinkedIn.com: How to clear Linkedin link preview cache?...

After updating your website with perfect preview content and image, if you try sharing your website link you will still see old preview content and image. That's because LinkedIn caches link preview content for 7 days.

So, if you mean the image is expiring in that the cache isn't being updated, then that would be your problem.

You can clear the cache easily: Use the LinkedIn Post Inspector. Inspect your site with the LinkedIn Post Inspector. This causes LinkedIn to refresh your share URL's preview. It also provides useful information on how your site is rendered.

If you want to check, to verify, that it is a caching problem, then try this: share example.com?test=1 instead of example.com on LinkedIn. Since the URL is technically different, there'll be a cache miss, and LinkedIn will have to generate a fresh preview. This will at least confirm if it is a caching problem.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
  • This would be correct for sharing external URLs on LinkedIn. However, when sharing an article hosted on linkedin.com, the URL of that page's og:image expires and will fail. I got around this by downloading and caching the image myself. – gvjonjones Oct 19 '20 at 09:24