Open Graph: og: differences in image display BETWEEN LINKEDIN AND FACEBOOK

It seems that Facebook and LinkedIn have different standards for og: image. On Facebook, they report that the image must be at least 200 x 200 pixels (square) see here . However, LinkedIn advises 180 x 110 pixels (rectangle), see here .

Is there a way to target an og image: either on Facebook or on LinkedIn separately? What is the best way to do this?

I am trying to create a default thumbnail for a website’s homepage that will allow users to share the homepage. At the moment, LinkedIn is trimming my og: image, although Facebook and Google+ share them nicely.

+6
source share
2 answers

That should 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" /> 
+9
source

Something similar may work depending on the server environment.

 <meta property="og:image" content="<?php echo(strpos($_SERVER['HTTP_USER_AGENT'],'LinkedInBot') !== false ? 'image-180x110.jpg' : 'image-200x200.jpg'); ?>" /> 
0
source

Source: https://habr.com/ru/post/948061/


All Articles