El recuento de comentarios de Facebook siempre muestra 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.

preguntado el 04 de julio de 12 a las 08:07

1 Respuestas

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

Tras el 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>
    (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'));
<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.

Respondido 04 Jul 12, 10:07

Thanks for the fast reply, I tried using the js you sent but I then I didn't get a number at all (instead of a 0). I tried adding a &appId=1111111111 after the #xfbml and it still didn't work. - Yuval

That is strange. I just tried it again and I got "42721 awesome comments". Can you try change example.com to a number of high profile sites and see if you get any figure at all? - Neil

You are right. it does show a number when I use example.com (25 comments). When I try a page that has comments for sure on my site, it shows 0 comments. Could it be a conflict with the fb login component on the masterpage? - Yuval

@Yuval can you try the link below replacing facebook.com with your url please? https://api.facebook.com/method/fql.query?query=SELECT url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='www.facebook.com' - Neil

That's funny, I put my address in the query and i get 0 in the count (I tried different sites and got good results). you can check out the url and see that i do have comments on the page(and i'm not crazy :) ) api.facebook.com/method/… - Yuval

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.