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

匿名 (未验证) 提交于 2019-12-03 03:10:03

问题:

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.

回答1:

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?



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!