user350530
user350530

Reputation:

How to Set Facebook Share Image (Only as a Fallback)?

We can of course use the following to set the default share image:

<meta property="og:image" content="http://website.com/images/icon.png" />

However, is there a way to set it as a fallback only, instead of a default? Meaning, only to be used IF Facebook can't find a larger, more appropriate image to use from the blog post.

Note - Facebook already scrapes on its own automatically without any help from the website owner to try and find the most appropriate image. Only, if there's not an image used or too small of one it would be nice if it used a user-defined fallback instead of some other non-related arbitrary image found on the page.

A better understanding of what criteria is set for the Facebook share scraping bot would help a lot. Or if it were possible to simply specify to only collect an image from a specific div ID or class and that if none is found to use the fallback.

Upvotes: 6

Views: 8939

Answers (1)

robobobobo
robobobobo

Reputation: 759

You may find the answer in here How to show particular image as thumbnail while implementing share on Facebook?

Facebook won't be able to go and check for a "larger more appropriate image" by itself. You'll need to specify it somehow. ie. Your wordpress Featured image or something like that

What you could do is structure your header so that you have the fallback one first, and then if available, you could override it?

<meta property="og:image" content="http://website.com/images/fallbackimage.png" />
 if bigger image specified
 <meta property="og:image" content="http://website.com/images/big-image-specified.png" />

Is that any help?

Upvotes: 7

Related Questions