Dynamic Open Graph settings for each social network

Hello,

It is possible to have a different image in Open graph when we share the post on Facebook, Twitter, and Pinterest? To have a specific image for each social network and one for the blog.

OG comes from Facebook. Other networks look for it if they don’t find something more specific for them. For example, Twitter has a similar thing called Twitter Cards.

https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started.html

If Twitter finds a Twitter Card, then it won’t use OG.

1 Like

True, I was not 100% if such a thing is possible, the client made a wrong request. I didn’t know about Twitter Cards thank you!

I didn’t find something similar for Pinterest, but there’s 2 ways to explore:

  1. you can set up to 6 ig images (use custom code) with variable dimensions. If Pinterest and FB look for different dimensions, they’ll grab the one that’s closest. So you can maybe search what they look for, and try to add appripriate formats.

  2. I’ve read that it’s possible to dynamically serve an OG image depending on the user agent of the request (fb or pinterest); this requires js code.

I think your desire to have a different image per network is very legitimate, as they all have a favorite, or best viewed/more appropriate image format to display. It may require code and time but this should be feasible.

1 Like

For those looking for a Pinterest share implementation you could adapt, use the code from this pen on Codepen. I created it the other day to help another forum member.

https://codepen.io/wfhow/pen/GbLwRJ

2 Likes

Where I can find this kind of codes? (I’m a non-developer, but I’m learning)

Try Google, Stackoverflow. But what you’re looking for is maybe more a developer :slight_smile:

Yes, I’m looking for a dev. Thank you for your useful tips!

No problem. That would be awesome if you come back here to tell us how you solved your challenge.

Yes, I’d be glad to help. Certainly, I will.

1 Like