在Django中自定义Facebook分享按钮?

时间:2015-01-28 21:10:05

标签: python django facebook

我正在尝试自定义我的facebook分享的内容,但我无法成功完成此操作。根据文档(https://developers.facebook.com/docs/web/webmasters)。我添加了og标签:

        <meta property="og:url" content="www.mysite.com" />
        <meta property="og:title" content="Check out this link" />
        <meta property="og:description" content="This is a test description" /> 
        <meta property="og:image" content="http://img1.123freevectors.com/wp-content/uploads/new/icon/075-smiley-face-vector-art-free-download-l.png" /> 

我的facebook html包含这个:

<div class="fb-share-button" data-layout="button"></div>
<script>(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/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

当我使用facebook调试工具调试此代码时,我收到警告。这些警告对我来说没有意义,因为当我检查元素时,og标签位于头部。警告是:

Inferred Property   The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property   The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property   The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property   The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.

这可能是什么问题?

0 个答案:

没有答案