来自Django App的Facebook Share Button

时间:2015-05-02 23:39:27

标签: django facebook-sharer facebook-ui

我的Facebook分享按钮没有在我的Django应用程序上获取元标记。我现在正在尝试更自定义的功能但是会出错 “无法解析网址http://localhost:8000/上的对象。”

我尝试了很多不同的方法,但我无法使元标记生效,否则我会收到“解决对象”错误。我在Facebook App设置中将“http://localhost:8000/”指定为我的网站网址。我希望用户能够通过我的html页面向Facebook分享{{ poll.question }}内容......我哪里出错?

<meta property="og:url"                content="http://localhost:8000/" />
<meta property="og:type"               content="article" />
<meta property="og:title"              content="Check out this forecast on CASSIE: {{ poll.question }}"/>
<meta property="og:description"        content="Join Cassie to forecast this and more! See how accurate you are at \
                                                predicting the future!" />
<meta property="og:image"              content="{{MEDIA_URL }}/social/logo_words.png" />


<div class="text-center" id="fb-root">
  <div class="btn btn-primary" onclick="fbshare()"></div>
</div>

{% block js %}
<script>
    function fbshare(){
        FB.ui({
          method: 'share',
          href: 'http://localhost:8000/',
          picture: '{{MEDIA_URL }}/social/logo_words.png',
          caption: 'Forecast the Future with CASSIE',
          description: 'Forecast future events- earn points for correct predictions!'
        }, function(response){});
    }
</script>
{% endblock js %}

0 个答案:

没有答案