Why is my Linkedin OG image not working
The social share image works on all other social media sites besides Linkedin? Here's what you need to do.
Last updated on|
You have included all the necessary tags needed for your OG social image to work. And in fact, it works fine on Facebook and Twitter. However, it doesn't work on Linkedin. Let's go over several common techniques on debugging and fixing this issue.
Utilise Linkedin post inspector
Head over Linkedin's Post inspector and paste the URL of the problematic page. Does the image show correctly? If it does, it means that it was a cache issue. If not, continue reading this article.
Double-check Linkedin's image requirements
Linkedin has image requirements when sharing a webpage. Make sure to that your OG image is within these limits:
- Max file size: 5 MB
- Minimum image dimensions: 1200 (w) x 627 (h) pixels
- Recommended ratio: 1.91:1
If one of these requirements is not met, Linkedin might not display your image when sharing your page.
The image filename shouldn't have any spaces
This is not documented anywhere on the Linkedin website, but from personal experience this is 100% a factor.
Make sure that your image filename doesn't have any spaces. It would work 90% of the time, but the other 10% will leave you wondering what is going on.
- ✅ "og_image.png"
- ❌ "hey this is my social sharing image.png"
!Update! - a developer contacted Linkedin to ask them about this exact issue and he finally got a response:
In order to pull that image and place it in the preview window when your URL is shared on LinkedIn, we need to encode that URL using a media service called Vector. We do this for every image and there is no way around this process. When we encode your URL, this is what we receive - https://images.prismic.io/something/1b15a138-d650-44dc-96d4-b4f7e173fd18_Best%2BTools.png?auto=compress,format
This is not a bug, this is the same process we use for every URL that is shared with an image. The member's URL is not encoding properly and is providing us with the wrong encoded URL and we receive an error - https://images.prismic.io/something/1b15a138-d650-44dc-96d4-b4f7e173fd18_Best%2BTools.png?auto=compress,format
You will need to speak with your web developer to have them take a look and see why your URL cannot be encoded properly. We are not able to fix that on our end. Unfortunately, we do not have any workarounds we can provide for you for this. So if you are not able to speak with your web developer to take a look and make changes, we just are not able to pull the image. We also cannot manually add an image to your post on your behalf.
So it seems that Linkedin are encoding the image URLs before creating a post. If you have a space (or potentially other special characters such as "+" which would be encoded) in the name, then they might encode it in such a way that it breaks the URL format for your image, resulting in a 404.
Place your OG tags as early as possible within the head tag
This might be a problem if you are using Gatsby.
Crawlers for Facebook and Linkedin might stop trying to find the og image meta tag since it's too far into the source code. This is because they have a certain amount of KB of data they can crawl before they give up.
This means that if you have a big CSS file which comes before your OG tags, the crawler will never read it even though it is in the head tag.
Linkedin prefers .jpg files
This is just a theory, but it seems that Linkedin likes .jpg more than .png
This has been observed by other developers as well.
Image filename is too long
Tough luck if you have reached to this point of the article and your Linkedin social image is still not working. For the really desperate, here's another theory - the image filename is too long.
All the technical SEO you'd need within our dashboard - just for
SEO component, structured data, favicon setup, sitemap setup and much more in your framework and language.Learn more
Lifetime access for (early bird price)