Posted by On 9:25 PM with No comments

Bài viết này hướng dẫn cách thức chèn khung comment Facebook cho Blogspot.

Đặc điểm của khung comment này cho phép kiểm duyệt trước khi post bài hay cũng có thể cho xuất bản comment mà không thông qua kiểm duyệt.

Tạo Khung Comment Facebook Cho Blogspot

Vào chỉnh sửa template tìm ]]></b:skin>, sau đó chèn đoạn mã này ngay sau đó.

<meta content='xxxxxxxxxxxxxxx' property='fb:admins'/>
<meta content='yyyyyyyyyyyyyyy' property='fb:app_id'/>

Để biết được fb:admins của mình là bao nhiêu có thể xem hướng dẫn Cách Tìm Facebook Page ID
Biết được thông tin fb:app_id thì vào link: https://developers.facebook.com/apps/. Trong trường hợp chưa có app nào thì tạo 1 app mới để lấy id.

Trước khi kết thúc thẻ </body>, chèn đoạn code này ngay phía trên nó.

<!-- facebook script -->
<div id='fb-root'/>
<script>
window.fbAsyncInit = function() {
    FB.init({
      appId      : &#39;yyyyyyyyyyyyyyy&#39;, // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });
    // Additional initialization code here
  };
  // Load the SDK Asynchronously
  (function(d){
     var js, id = &#39;facebook-jssdk&#39;, ref = d.getElementsByTagName(&#39;script&#39;)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(&#39;script&#39;); js.id = id; js.async = true;
     js.src = &quot;//connect.facebook.net/en_US/all.js&quot;;
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>
<!-- facebook script -->

Điều quan trọng nhất là khung comment, chèn vào chỗ nào muốn hiển thị.

<div class='comment-facebook'>
<fb:comments colorscheme='light' data-numposts='10' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' order_by='reverse_time' width='620'/>
</div>

Trong một vài trường hợp, sử dụng code sau để khung comment chỉ hiển thị ở mục bài viết.

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class='comment-facebook'>
<fb:comments colorscheme='light' data-numposts='10' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' order_by='reverse_time' width='620'/>
</div>
</b:if>

Chú ý: thay đổi các thông số màu đỏ, in đậm.
Tuyển tập những ca khúc hay nhất của Lệ Quyên
Next
« Prev Post
Previous
Next Post »