Search code examples
commentsruby-on-rails-3.2disqus

Disqus `count.js` displays '0 Comments' on production


The comment count on my index page doesn't reflect the actual count for each entry in my blog. When running locally in development it reflects the actual count, but once I push it to production on Heroku it displays '0 Comments and 0 Reactions', even though there is at least one comment. I added the JS that Disqus provides at the bottom of my index.html.haml and added a link for the comment count. Here's my code for scrutinizing:

%p
  = "* Comments - "
  = link_to e, entry_path(e, :anchor => "disqus_thread")
.date= e.updated_at.strftime('* %a, %b %-e, %Y @ %l:%M %p %Z') 
%br

:javascript
  /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  var disqus_shortname = 'heneman'; // required: replace example with your forum shortname

  /* * * DON'T EDIT BELOW THIS LINE * * */
  (function () {
    var s = document.createElement('script'); s.async = true;
    s.type = 'text/javascript';
    s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
    (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
  }());

Also, here is a link to my blog. If you look at the second entry down (titled "Add Markdown To A Rails 3.2 App") you'll see the comment count displays '0', but if you click on the title and go into the show page for that entry, you'll see there's a comment.

Has anyone else encountered this?


Solution

  • Try adding the disqus-identifier as data-disqus-identifier in your comment link as described here. Look at your front page HTML source code for start page. Its rendering <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body> for every post out there which is not a standard i think.