After seeing Disqus in action on Keith Elder’s blog, I decided to incorporate it in my Veritas Blog Engine redesign.  Setting up Disqus is pretty easy.  If you’re using a more standard blog engine (Wordpress, Blogger, etc) than they have plugins and very easy to use integration methods.  If you’re writing your own site, you just need to drop some javascript onto your page and replace a few values.  Specifically, you have to put in your account name, the blog entry url, and the unique page title (or disqus identifier).  There are a couple caveats to using Disqus.  Prior to using it, a viewer could comment on any entry shown on the home page without having to go to the entry’s unique page (so the comments for multiple entries were viewable on the same page).  Unfortunately, Disqus can’t handle this.  You can only show the “disqus comments” for one entry at a time.  So now, viewers have to click and go to the unique page to add comments (or even just view the comments).  I think that with the ease of use of Disqus for administering comments as well as users logging in with their info to add comments makes this trade off worth it.  Importing is another issue though.

When I first started looking at Disqus, I saw that you could import comments and figured that as long as I could import, I could figure things out and make it work.  This did prove to be true, however, there were a few hoops to jump through.  If you checkout Disqus and want to import from WordPress or Blogger, then they have an easy to use format for importing your comments.  If, however, you’re using your own format, they do provide a generic format (WXR) to import your comments.  You can read about and checkout this format here.  The format is documented, though not as well as it could be.  Both the Content:Encoded and the comment_content are shown using CDATA for the content.  Presumably so you don’t have to bother encoding the html of your blog entry and the comment.  In the course of running into issues I ended up just encoding my html and not using CDATA at all. 

Another issue I ran into while getting my xml ready was the link to the blog entries.  I had a few links that had apostrophes in them.  While this seemed to work fine in several browsers, it ended up being very problematic after I imported my comments (this was my own fault and not Disqus’).  Just make sure your urls are properly encoded (i.e. replace your apostrophes with %27).

The last issue I ran into, I will blame on Disqus.  Their import example has the following in the xml:

   1:  <!-- sso only; see docs -->
   2:  <dsq:remote>
   3:    <!-- unique internal identifier; username, user id, etc. -->
   4:    <dsq:id>user id</dsq:id>
   5:    <!-- avatar -->
   6:    <dsq:avatar>http://url.to/avatar.png</dsq:avatar>
   7:  </dsq:remote>

Now I don’t know if there are some docs (as in “see docs”) that I didn’t see but I assumed (incorrectly) that I should send over my ID for the commenter.  That was a bad assumption.  This section caused my comments and threads to not be imported at all.  Furthermore, the import process doesn’t really give you any information about why your xml does or does not work.  I did send a couple tweets back and forth with Disqus, though I don’t think they actually looked at the xml I was trying to import (and presumably they would have seen the DSQ Remote section and told me to drop it right away).  Once I dropped that section from all of my item elements, the import worked great (besides the URL encoding issue I mentioned above).    Below you can see an example of the xml I ended up importing.  There is one Item element in this xml where my full import had one item for each comment.

   1:  <?xml version="1.0" encoding="UTF-8"?>
   2:      <rss version="2.0"  xmlns:content="http://purl.org/rss/1.0/modules/content/"  xmlns:dsq="http://www.disqus.com/"  xmlns:dc="http://purl.org/dc/elements/1.1/"  xmlns:wp="http://wordpress.org/export/1.0/">  
   3:          <channel>    
   4:              <item>
   5:                  <title>re: Detroit Restaurant Week: My First Android App</title>
   6:                  <link>http://chrisrisner.com/Detroit-Restaurant-Week--My-First-Android-App</link>
   7:                  <content:encoded>&lt;p&gt;&lt;My Encoded Html&lt;p&gt;</content:encoded>
   8:                  <dsq:thread_identifier>Detroit-Restaurant-Week--My-First-Android-App</dsq:thread_identifier>
   9:              <wp:post_date_gmt>2011-03-20 23:32:00</wp:post_date_gmt>
  10:              <wp:comment_status>open</wp:comment_status>
  11:              <wp:comment>
  12:                  <wp:comment_id>188</wp:comment_id>
  13:                  <wp:comment_author>MyName</wp:comment_author>
  14:                  <wp:comment_author_email>Test@TestComment.com</wp:comment_author_email>
  15:                  <wp:comment_author_url>http://www.chrisrisner.com</wp:comment_author_url>
  16:                  <wp:comment_author_IP>24.145.221.93</wp:comment_author_IP>
  17:                  <wp:comment_date_gmt>2011-03-27 18:00:35</wp:comment_date_gmt>
  18:                  <wp:comment_content>Now to port it to WinPhone7!</wp:comment_content>
  19:                  <wp:comment_approved>1</wp:comment_approved>
  20:                  <wp:comment_parent>0</wp:comment_parent>
  21:              </wp:comment>
  22:          </item>  
  23:      </channel>
  24:  </rss>

UPDATE: Dex informed me (below in comments) that if you go to http://import.disqus.com and click on the "All Imports" tab, you can see the status of your import as well as if an error occurred and on which line it occurred. Thanks Dex!


Chris Risner