Yuval
Yuval

Reputation: 317

Facebook comment-count always showing 0

i've been trying to implement the facebook comments-count feature on my website (using html and C#). it's a dynamic page, created from the code behind like so:

tmpGuides = tmpGuides + "<img src=\"images/comments.gif\" alt=\"\" style=\"vertical-align: baseline;\" />" + "<fb:comments-count href=http://www.someexamplesite.com/article.aspx?=1909/> </fb:comments-count> "; 

it always shows 0 instead of the real amount of comments.

i'm working from my local machine now, but i tried uploading the code to production and it still doesn't work. I also tried url encoding the address.

Upvotes: 1

Views: 4047

Answers (1)

Neil
Neil

Reputation: 1066

You do seem to have the right syntax. Are you sure there are definitely comments on the url you are using?

Following the documentation on facebook, under the heading "How do I access the number of comments left of my page?", you can see the code below works for "example.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_GB/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
    </script>
<fb:comments-count href="http://example.com/"></fb:comments-count> awesome comments 

If you can get try get it working for example.com then you know that you don't have a problem with your code and it is more likely that there are no comments on the url you are specifying.

Upvotes: 4

Related Questions