🧠 What I Learned Today: Fixing LinkedIn's Cached OG Image Like a Pro!

Ayush HardeniyaAyush Hardeniya
2 min read

Ever pushed a shiny new Open Graph (OG) image on your website, shared it on LinkedIn... and saw the old version still pop up?
Yep - same here. Here's how I fixed it in less than 10 minutes, and what I learned in the process.


🚩 Problem

I had just updated the OG image on my personal website. But when I tried sharing the link on LinkedIn, it still showed the previous version of the image.
At first, I thought maybe I made a mistake while uploading...

🖼️ [Screenshot: Old OG image being shown on LinkedIn]

Old OG image being shown on LinkedIn


🕵️‍♂️ Investigating via LinkedIn Post Inspector

I headed to LinkedIn Post Inspector to see what was being cached.

Surprisingly, it showed the correct updated OG image - which meant LinkedIn's backend had already crawled and updated the image.

🧩 [Screenshot: Post Inspector showing the updated OG image correctly]

Post Inspector showing the updated OG image correctly


🛠️ Solution: Cache Busting with [ ?v=2 ]

Turns out, LinkedIn aggressively caches images, even after you update them.

🔧 The Fix? A simple query string:

<meta property="og:image" content="https://ayushhardeniya.site/assets/website-pw-1.png?v=2">

Just by adding ?v=2 to the image URL, LinkedIn thinks it's a new resource.
I redeployed my website with the updated tag.

🧪 [Screenshot: Code editor showing updated OG tag with ?v=2]

Code editor showing updated OG tag with ?v=2


✅ The Result: Success!

Went back to Post Inspector, ran the URL again, and... bam! The updated OG image finally showed up.

🎉 [Screenshot: LinkedIn showing the updated image after purging]

LinkedIn showing the updated image after purging


📚 What I Learned

  • LinkedIn aggressively caches OG images (more than expected).

  • Adding a simple ?v=2 or any version number is a clean way to bust cache.

  • Tools like LinkedIn Post Inspector are gold for debugging social previews.

  • Don’t forget to redeploy your site after editing meta tags.


💬 Final Thought

Small fixes like these often seem trivial, but the clarity they bring to your digital identity is huge.
It was a 10-minute fix, but I enjoyed learning something new.

~Ayush Hardeniya

0
Subscribe to my newsletter

Read articles from Ayush Hardeniya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ayush Hardeniya
Ayush Hardeniya

Hey, I'm Ayush Hardeniya (aka Ayush Sharma) 👋 An engineering student who treats every coding challenge like a 🎮 new level to conquer. Through daily reflections, real-world problems, and code breakdowns, I document my journey --- not just to grow, but to help others grow with me. Because honestly... I don’t code, I play it. 🔥