Facebook comments plugin - same comments on every

2020-03-24 06:42发布

Facebook comments on my website work well except the fact when someone comments on one article that same comment shows up on every article on the website. Obviously, I don't want that. What I did is basically copy and paste code offered on developers.facebook.com:

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


     `<div class="fb-comments" data-href="http://example.com" data-num-posts="2" data-                                      width="470"></div>`

What did I do wrong? I would appreciate any help.

Vio

8条回答
一纸荒年 Trace。
2楼-- · 2020-03-24 07:21

I put the page url after the domain and it's work for me. MyDomain is the domain I out when I create the code on the Facebook comments.

<div class="fb-comments" data-href="http://MyDomain/Mypage URL" data-numposts="5" data-colorscheme="light"></div>
查看更多
祖国的老花朵
3楼-- · 2020-03-24 07:21

Due to the need to have separation of concerns...."data-href" tag is there to serve...

For example: if you have some page www.example/123.com,,,, your data-href value must be www.example/123.com....

For doing this means is that render and store comments for www.example/123.com and it will not then appear on other pages....

查看更多
登录 后发表回答