The same Facebook comments appear on every post on

2019-05-11 01:28发布

问题:

I have a blog on Blogger and I just installed the new FaceBook Comments plugin. The code looks like this.

<div id="fb-root"></div>
<script>(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));</script>
<fb:comments href="zephraz.blogspot.com" num_posts="10" width="490" colorscheme="dark"></fb:comments>

I am really having a difficult time because the same comments appear on each of the post on my blog. I am a newbie and I know nothing about coding and etc. Can anyone help me on this one?

回答1:

Change:

href="zephraz.blogspot.com"

To:

expr:href='data:post.url'


回答2:

Adding facebook comments to blogspot is pain. But not impossible at all.

I had used same code which you are using now and my comments were same for entire blog.

I didnt want this. It gives you different comments for different posts.

refer Adding Facebook Comments for Blogger

Follow the instruction properly and you will get the result. It works. I have tried this on my own.



回答3:

Actually, I had the same question. Through research, I stumbled upon the below forum thread and followed the steps.

So far, I have no problems with the comments plugin on this blog I'm hired to work on. check the plugin working here.

It wont be on the homepage, just click any post, it will have the comments box below.



回答4:

Adding: expr:title='data:post.title' expr:href='data:post.canonicalUrl' expr:xid='data:post.id'

instead of the blog url (in addition to the main code that has to be added in the head section of the page) adds the comment form to individual posts instead of the form appearing for all the posts.

Even I had the same problem and finally found the solution for it. Works fine.

GBU Arti



回答5:

This may help you :
http://socialmouths.com/blog/2012/02/16/add-facebook-comments-to-your-blog/



回答6:

<?php
 $url = (!empty($_SERVER['HTTPS'])) ? 
 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : 
 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
?>

<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="2" data-width="470"></div>