Disqus Comment Count Always 0 Comments

2019-07-04 21:31发布

问题:

I think I've set up Disqus as instructed for universal code.

Trouble is that it always says that a post has 0 comments.

Take this post: http://tx0rx0.com/retropie-and-the-raspberry-pi/

which discus says has 11 comments, and then compare to the front page

http://tx0rx0.com

I thought all you needed was a link to the page with the disqus comments with #disqus_thread appended to it. Like so:

<a href="tx0rx0.com/retropie-and-the-raspberry-pi#disqus_thread>Comments</a>

and the javascript with correct shortname would do the rest. Where did I go wrong? Also, why is there a period there?

回答1:

The protocol and presence of trailing slashes matter when it comes to comment count lookups. Try this:

<a href="http://tx0rx0.com/retropie-and-the-raspberry-pi/#disqus_thread">Comments</a>

You might also consider using a 'disqus_identifier' and 'disqus_url' with the commenting embed, which you can then use in the comment count link like this:

<a href="http://tx0rx0.com/retropie-and-the-raspberry-pi/#disqus_thread" data-disqus-identifier="some_identifier_for_thread">Comments</a>

This will normalize the data between what is passed to us, and what you're expecting when you render the comment count links.