Disqus comments not visible in Octopress
After completing the migration of my blog from Wordpress to Octopress I had the surprise that Disqus comments were not showing up on the site. I’ve already migrated in advance to Disqus and the Wordpress blog was working just fine with the new format. However, once switched to Octopress there were no comments active on the site. Strangely, the total number of comments for each post on the index page was showing just fine, but once you clicked on any post there were no comments. I tested adding new comment and it did show up correctly in Disqus.
Trying to understand and debug this issue, I looked in source/_includes/disqus.html
and found the code that is generating the javascript variable disqus_identifier for the posts:
and looking in the html generated by some blog posts the variables disqus_url and disqus_identifier looked ok, like this:
var disqus_identifier = 'http://www.ducea.com//2012/11/12/disqus-comments-not-visible-in-octopress/';
var disqus_url = 'http://www.ducea.com//2012/11/12/disqus-comments-not-visible-in-octopress/';
var disqus_script = 'embed.js';
Still at a closer look I was able to identify the issue; if you look closer at the url above, it has a double / in the url, and even if that should not cause any issues and identify the same url, Disqus was actually seeing it as a separate identifier and hence not showing the comments associated with it. Once I figured it out it was very simple to see where it came form (the site url from _config.xml) was:
url: http://www.ducea.com/
and fixing it, by removing the trailing slash:
url: http://www.ducea.com
Regenerating and deploying the site:
rake generate
rake deploy
fixed the issue and the comments are now back on the site. (you can even try it out here on this post ;)
Hopefully this will help others that are in the same situation… if you just added an extra slash to the Octopress site url config and didn’t realize this brake the Disqus comments.