Thứ Năm, 19 tháng 3, 2015

Cách thêm comment Facebook vào blogspot

Cách thêm bình luận (comment) Facebook vào blogspot

Bước 1: Đăng nhập vào trang quản trị blog.

Vào "Mẫu" chọn "Chỉnh sửa HTML"



Bước 2: Ấn tổ hợp phím Ctrl F, tìm </head>

Chèn đoạn code dưới đây vào trước thẻ "</head>".

<!---->
<script type='text/javascript'>
//<![CDATA[
var purl= location.href;
var fb_href = purl.substring(0,purl.indexOf(".html")+5);
var fbcm ='<div class="fb-comments" data-href="'+fb_href+'" data-num-posts="8" data-width="766"></div>';
//]]>
</script>

<!---->

Lưu ý: Các bạn có thể thay tùy ý các thông số dưới đây

data-num-posts="8": Số bình luận được phép hiển thị, nếu nhiều hơn thì tự động gộp lại.
data-width="766px": Chiều rộng của khung bình luận Facebook.

Bước 3: Ấn tổ hợp phím Ctrl F, tìm </body>

Chèn đoạn code bên dưới và trước thẻ "</body>".

<!---->
<div id='fb-root'/> <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/vi_VN/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>

<!---->

Bước 4: Copy đoạn code bên dưới

<!---->
<b:if cond='data:blog.pageType == "item"'> <script type='text/javascript'> document.write(fbcm); </script> </b:if>
<!---->
Thông thường ta sẽ chèn nó vào cuối bài viết. Các bạn Ctrl F, tìm dòng <b:include data='post' name='post'/>
Copy và dán đoạn code bên trên vào phía dưới dòng vừa tìm được.

Lưu ý: Một số mẫu template (giao diện) có nhiều hơn một dòng <b:include data='post' name='post'/>, các bạn chọn dòng đầu tiên tìm được nha, sau đó lưu lại, nếu thấy không được thì ta chọn dòng khác :D

Bước 5: Save và xem thành quả



lesmile Author: lesmile

Hello, I am Author, decode to know more: In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet.

Previous
Next Post »

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles

© 2014 Le Smile PLus. WP themonic converted by Bloggertheme9. Powered by Blogger.