Since this blog is "baked" into a static website each time I post, it can't have an "in-house", dynamically generated commenting system.
Not only is my blogging set-up simpler for not having to support commenting "natively", I've also found Disqus does a pretty good job at minimising spam and reducing the general maintenance burden.
From the viewpoint of someone posting comments, however, there is at least one downside: it's not great when it comes to including code samples.
As I'm not the only ColdFusion blogger using Disqus (see Adam Cameron's excellent new blog for instance), here are some tips should you wish to illustrate your Disqus comments with CF or other code snippets:
- Enclose your code samples within
<pre><code>tags. Not only will the font change to present the code more clearly, Disqus will also attempt to apply syntax highlighting/colouring. You can help the parser by specifying the language as a class attribute to the
<code class="html">. Predictably I suppose, the list of languages Disqus's syntax parser supports doesn't include CFML.
- Watch out for self- or non-closing tags, such as
<cfreturn>(adding a trailing slash—
<cfargument/>—makes no difference). Currently Disqus's parser will insist on inserting closing tags for these in silly places, resulting in mangled code. The only way I've found to stop the automatic insertions is to close the tags explicitly yourself:
<cfreturn></cfreturn>. Not great, but at least you control where the tags are closed.
- Use cfscript if possible: given the above, it's a lot safer.
A limited set of other HTML tags are allowed for general formatting in Disqus comments.
UPDATE 2 February 2013 It seems that the Disqus syntax support is even worse than I thought. If you include any of the allowed HTML tags, they will not be escaped.
And as one commenter below has discovered, even PHP is not properly supported, despite being on the supported language list.
I've reported these issues to Disqus who have replied acknowledging the HTML conflict, adding:
We are looking into implementing a Markdown-style code that could do the formatting for you, but it may take some time to implement.