2012-05-17 82 views

回答

8

能夠通過JavaScript來完成。只需添加Facebook SDK並在模板底部添加評論即可。只要確保有某種蛞蝓的唯一識別頁面

<body> 
<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
    appId  : 'YOUR_APP_ID', // App ID 
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File 
    status  : true, // check login status 
    cookie  : true, // enable cookies to allow the server to access the session 
    xfbml  : true // parse XFBML 
    }); 
}; 

(function(d){ 
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
    if (d.getElementById(id)) {return;} 
    js = d.createElement('script'); js.id = id; js.async = true; 
    js.src = "//connect.facebook.net/en_US/all.js"; 
    ref.parentNode.insertBefore(js, ref); 
}(document)); 
</script> 

... 

<div 
    class="fb-comments" 
    data-href="{{ my_object.slug }}" 
    data-num-posts="2" 
    data-width="470"></div> 

https://developers.facebook.com/docs/reference/plugins/comments/

+0

感謝@Timmy奧馬奧尼 – sultan

+0

沒有更多的渠道文件: > **的JavaScript的SDK更改瀏覽器的要求* * >爲了使JavaScript SDK能夠與Facebook通信,我們現在需要本機支持HTML5 postMessage或支持Flash,最低版本8.0.24。作爲此次更改的一部分,我們不再支持使用channelUrl初始化選項來提供回退機制。 來源:[Facebook的博客,2013年11月](https://developers.facebook.com/blog/post/2013/11/21/platform-updates--new-design-for-follow-button-and-like -box - IOS-SDK-改進和 - 多/) – silpol