Facebook分享没有显示开放图元标记的图像

cgr*_*ham 13 html javascript facebook social-media meta-tags

我正在尝试将Facebook共享按钮集成到我的雇主的网站,标题,网址,说明/介绍都正确显示,但没有附加图像.当共享对话框打开时,图像容器会闪烁然后消失,就像facebook正在尝试处理图像但失败一样.

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

<meta property="og:image" content="/images/logo_white_150px.png" />
<link rel="image_src" type="image/png" href="/images/logo_white_150px.png" />
Run Code Online (Sandbox Code Playgroud)

该图像曾经工作(它适当缩放)但不再适用,我也尝试过其他不同尺寸和格式的图像而没有运气.

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

<!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>
Run Code Online (Sandbox Code Playgroud)

这是我在身体开始时使用的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>
  ...
Run Code Online (Sandbox Code Playgroud)

以下是我使用按钮的方式:

  <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>
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助,谢谢提前
克里斯.

DMC*_*MCS 0

由于没有看到代码的 HTML 输出,我只能猜测这个问题。不要使用像 这样的相对 url <%=shortUrl%>,但一定要使用完全限定的 Url.... 上面有 http(s):// 的内容。

另外,http://developers.facebook.com/docs/share/表示此共享按钮已被弃用。请改用“赞”按钮:http://developers.facebook.com/docs/reference/plugins/like/