27 Oct 2007

Adding Post Only Comments On Tumblr

Here’s some useful Javascript code if you want to add post-only (not displayed on the home page) comments to your Tumblr blog.

if (location.href.indexOf ('post') != -1) {
  elem = document.createElement ('script');
  elem.setAttribute ('src', 'http://js-kit.com/comments.js');
  elem.setAttribute ('type','text/javascript');
  document.getElementsByTagName ('head') [0].appendChild (elem);
}

It uses the JS-Kit comment widget, and “loads” the javascript only if the word “post” is found in the URL. It works in Firefox 2, Opera 9 or IE7.

Update: Tumblr now has a block:Permalink block to render comments or other post-level widgets.