MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Disqus Comments Not Visible in Octopress

| Comments

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:

1
2
3
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:

_config.xml
1
url: http://www.ducea.com/

and fixing it, by removing the trailing slash:

_config.xml
1
url: http://www.ducea.com

Regenerating and deploying the site:

1
2
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 realise this breake the Disqus comments.

Comments