Facebook 分享故事图片第一次没有出现

Facebook Share Story Image Does Not Appear For First time

我尝试分享文章或网页,但是第一次分享时故事不显示图像,但是当我下次分享时,图像来了。

在FB Debugger里查过 还有,同样result.image不是第一次来,下次来。

<html class="no-js" lang="ar" dir="rtl" data-ng-app="mApp" xmlns:fb="http://ogp.me/ns/fb#">
<meta property="og:title" content="mytitle"/>
<meta property="og:url" content="http://mytest.com"/>
<meta property="og:image" content="http://mytest.com/1-773128.jpg"/>
<meta property="og:description" content="ffff2024"/>
<meta property="og:site_name" content="ggggggg"/>
<meta property="og:type" content="ARTICLE"/>
<meta property="fb:app_id" content="2444444444444"/>

https://developers.facebook.com/docs/sharing/best-practices#precaching 列出了避免此问题的方法,方法是

  • 通过API或

  • 预先抓取新文章
  • 也通过 OG 元标记指定图像尺寸。

更新

这个带有 iframe 的解决方案 不再有效 !从昨天 2017 年 2 月 6 日开始工作。 Facebook 刚刚将 X-Frame-Options 设置为 DENY,因此您无法在 iFrame 中加载共享器 url。 我正在寻找另一种解决方法。


我努力为这个 facebook 错误找到解决方案(添加 og:image:width 和 og:image:height 是不够的)。

最后我想出了一个可行的解决方法:我在页脚中添加了一个带有共享器 link 的隐藏 iFrame;通过这种方式,Facebook 爬虫会在页面加载后检查页面,当您第一次点击 facebbok 分享按钮时,您可以看到分享的图片!

示例:

<iframe style="width: 0px; height: 0px; margin: 0px; padding: 0px;" src="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.example.com"></iframe>