Open Graph: og:image display differences BETWEEN LINKEDIN AND FACEBOOK
Asked Answered
L

2

10

It appears that Facebook and LinkedIn have differing standards for the og:image. On Facebook they advise that the image should be at least 200 x 200 pixels (square) see here However LinkedIn advise 180 x 110 pixels (rectangular) see here

Is there a way to target an og:image to either Facebook or LinkedIn seperately? What's the best way of doing this?

I'm trying to create a default thumbnail for the website home page which will let users share the home page in a nice manner. At the moment LinkedIn is cropping my og:image though Facebook and Google+ are sharing it nicely.

Lamdin answered 25/6, 2013 at 12:41 Comment(0)
G
10

This ought to do it.

<meta property="og:image" content="image-180x110.jpg" /> <!-- 180x110 Image for Linkedin -->
<meta property="og:image:width" content="180" />
<meta property="og:image:height" content="110" />
<meta property="og:image" content="image-200x200.jpg" /> <!-- 200x200 Image for Facebook -->
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
Galenic answered 16/8, 2013 at 4:29 Comment(1)
Did not do the trick for me. Facebook loads both images, but doesn't display the larger one when sharing.Internode
K
2

Depending on the server environment something like this may work.

<meta property="og:image" content="<?php echo(strpos($_SERVER['HTTP_USER_AGENT'],'LinkedInBot') !== false ? 'image-180x110.jpg' : 'image-200x200.jpg'); ?>" />
Katelin answered 31/3, 2015 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.