Facebook分享不显示图形元标记图像 [英] Facebook share not showing image from open graph metatags

查看:177
本文介绍了Facebook分享不显示图形元标记图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Facebook分享按钮整合到我的雇主网站,标题,网址,描述/介绍都正确显示,但没有附加图片。
当共享对话框打开时,图像容器将闪烁,然后消失,就像Facebook正在尝试处理图像,但失败。



我是使用og:image和链接关系来尝试并指定要用于共享链接的图像:

 < meta property = og:imagecontent =/ images / logo_white_150px.png/> 
< link rel =image_srctype =image / pnghref =/ images / logo_white_150px.png/>

该图像用于工作(适当缩放),但不再存在,我也尝试过其他不同大小和格式的图像没有运气。



这是我在标题中使用的打开的元标记:

 <!DOCTYPE html> 
< html xmlns:fb =http://ogp.me/ns/fb#itemscope itemtype =http://schema.org/Articlexmlns:og =http:// ogp。我/ NS#>
< head>
< meta property =og:typecontent =着陆页/>
< meta property =og:titlecontent =社交媒体测试页/>
< meta property =og:descriptioncontent =这是用于测试社交媒体按钮的行为的页面/>
< meta property =og:imagecontent =/ images / logo_white_150px.png/>
< link rel =image_srctype =image / pnghref =/ images / logo_white_150px.png/>
< meta property =og:image:typecontent =image / png/>
< meta property =og:urlcontent =<%= shortUrl%> />
< meta property =og:site_namecontent =site name/>
< meta property =og:mediumcontent =mult/>
< / head>

这是我正在身体开始使用的JavaScript:

 < body> 
< script type =text / javascript>
(function(d,s,id){
var js,fjs = d.getElementsByTagName(s)[0];
if(d.getElementById(id)){return;}
js = d.createElement(s); js.id = id;
js.src =//connect.facebook.net/en_US/all.js#xfbml=1;
fjs.parentNode.insertBefore(js,fjs);
}(document,'script','facebook-jssdk'));
< / script>
...

这里是如何使用按钮:

 < div class =leftstyle =text-align:center;> 
< a name =fb_sharetype =buttonshare_url =<%= shortUrl%>> Share< / a>
< script src =http://static.ak.fbcdn.net/connect.php/js/FB.Sharetype =text / javascript>< / script>
< / div>

非常感谢任何帮助,谢谢提前

Chris。

解决方案

如果刮刮的结果一切正常,尝试使用 Facebook Debugger



这是因为Facebook为og:data使用自己的缓存。 p>

I'm trying to integrate the Facebook share button to my employer's site, the title, url, description/intro are all displaying correctly, however no image is being attached. When the share dialog opens, an image container flickers and then disappears as though facebook is trying to process the image(s) but fails.

I'm using og:image and a link relation to try and specify the image to use for shared links:

<meta property="og:image" content="/images/logo_white_150px.png" />
<link rel="image_src" type="image/png" href="/images/logo_white_150px.png" />

That image used to work (it scaled appropriately) but no longer does, I've also tried other images of differing size and format with no luck.

Here's the open meta-tags I'm using in the header:

<!DOCTYPE html>
<html xmlns:fb="http://ogp.me/ns/fb#" itemscope itemtype="http://schema.org/Article" xmlns:og="http://ogp.me/ns#">
  <head>    
    <meta property="og:type" content="landing page" />
    <meta property="og:title" content="Social Media Test Page" />
    <meta property="og:description" content="This is a page for testing the behavior of social media buttons..." />
    <meta property="og:image" content="/images/logo_white_150px.png" />
    <link rel="image_src" type="image/png" href="/images/logo_white_150px.png" />
    <meta property="og:image:type" content="image/png" />
    <meta property="og:url" content="<%=shortUrl%>" />
    <meta property="og:site_name" content="site name" />
    <meta property="og:medium" content="mult" />
  </head>

Here's the JavaScript I'm using at the start of the body:

  <body>
    <script type="text/javascript">
      (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
      } (document, 'script', 'facebook-jssdk'));
    </script>
  ...

And here is how I'm using the button:

  <div class="left" style="text-align: center;">
    <a name="fb_share" type="button" share_url="<%=shortUrl%>">Share</a>
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
  </div>

Any help is much appreciated, thanks in advance
Chris.

解决方案

If everything is OK on the scraped result, try to fetch new scrap information using Facebook Debugger.

This is because Facebook use its own cache for og:data.

这篇关于Facebook分享不显示图形元标记图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆