Adding Comments to Tumblr

Someone asked me about this so here it is. I realized that adding comments to your Tumblr is not as straightforward as it may seem. Here is how you want to do it.:

  1. Sign up for a Haloscan account
  2. Go to the Install tab and choose Other/Manual to get the javascript code to paste on your site
  3. Switch your Tumblr to a custom layout so that you can edit the code
  4. Paste the first Haloscan snippet somewhere in the head
  5. Edit and paste the second snippet in your post blocks

The last point is the confusing one to some. Let me explain. Tumblr uses special tags to define blocks of code that do something different. For example take the following block:

{block:Regular}
	<div class="regular">
		{block:Title}
			<h2><a href="{Permalink}">{Title}</a></h2>
		{/block:Title}
		{Body}
	</div>
{/block:Regular}

It tells Tumblr how to display a single post (here we are looking at a regular text post). Note that all the stuff in braces is treated as special Tumblr tag. For example {Permalink} will expand to the full permalink URL of this given post, and {Title} will expand to it’s title.

Haloscan requires that you somehow create a unique identifier for each of the pages for which you want comments and pass it into their javascript calls. There are different ways to do it, but we can exploit Tumblr’s dynamic tags to automatically get a unique post ID for Haloscan. I simply chose to use the {Permalink} tag for this purpose.

My edited regular block looks like this:

{block:Regular}
	<div class="regular">
		{block:Title}
			<h2><a href="{Permalink}">{Title}</a></h2>
		{/block:Title}
		{Body}
	</div>
 
	<!-- HELOSCAN COMMENT CODE-->
	<a href="javascript:HaloScan('{Permalink}');" target="_self">
	<script type="text/javascript">postCount('{Permalink}');
	</script></a> | 
	<a href="javascript:HaloScanTB('{Permalink}');" target="_self">
	<script type="text/javascript">postCountTB('{Permalink}'); 
	</script></a>
	<!-- END OF HELOSCAN COMMENT CODE-->
{/block:Regular}

Note how I’m plugging the {Permalink} in all the places where Haloscan requires you to put the unique post ID. At runtime it will expand to the full URL which will be unique for each post. You can actually just copy and paste this snippet to your Tumblr - it does not include any account specific info. Repeat this for every block that you want to enable comments for. Tumblr defines different blocks for regular posts, links, conversations, videos, images and etc..

Anyway, this is all there is to it. I hope you find this helpful. )

Related Posts:

  • /dev/random now with comments
  • Tumblr
  • Is anyone else having issues with Tumblr?
  • Site Outage: Database Problems
  • Site Outage and Commenting Problem
  • The Parrot
  • Lucy Liubot
  • New Features for You!
  • Blogs Without Comments
  • Don’t Close Comment Threads on Old Blog Posts

  • 19 Responses to “Adding Comments to Tumblr”

    1. Gravatar dave UNITED KINGDOM Says: Reply to this comment

      very useful, works a treat - thanks a lot!

      Posted using Flock Flock 0.7.14 on Mac OS Mac OS X
    2. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      Glad I could help. )

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.6 on Ubuntu Linux Ubuntu Linux
    3. Gravatar Shannon Seery Says: Reply to this comment

      Thank you for this. The solution worked perfectly.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.6 on Windows Windows XP
    4. Gravatar Tal Shafik ISRAEL Says: Reply to this comment

      Just what I’ve been looking for. Thanks!

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.6 on Windows Windows XP
    5. Gravatar dry MALAYSIA Says: Reply to this comment

      I’ve been going mad trying to sort comments out this morning, before finding this advice. Thank you so much.

      cheers

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.8 on Windows Windows XP
    6. Gravatar Freddie CANADA Says: Reply to this comment

      Thanks! Much appreciated!

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.9 on Windows Windows XP
    7. Gravatar Norman GERMANY Says: Reply to this comment

      Very nice, pretty usefull. Going to try that out right now.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.10 on Windows Windows XP
    8. Gravatar kim REPUBLIC OF KOREA Says: Reply to this comment

      appreciated!!!

      Posted using Safari Safari 3.0.4 on Mac OS Mac OS X
    9. Gravatar gijyun UNITED STATES Says: Reply to this comment

      hi there - i’m trying to install haloscan code into tumblr; i can’t find anywhere in tumblr that gives me the option to switch it to “custom,” or a place to enter code manually. do you know anything else about this?

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.11 on Windows Windows XP
    10. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      @gijyun - from the Dashboard pull down the Account menu and go to Themes. You can choose the Custom HTML option in the right pane.

      Since the HTML textbox is so small I recommend copying it into a text editor, adding the haloscan code and then pasting it back in.

      mrgreen

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.9 on Ubuntu Linux Ubuntu Linux
    11. Gravatar Todd UNITED STATES Says: Reply to this comment

      This post saved my ass…thank you Luke!

      Posted using Mozilla Firefox Mozilla Firefox 3.0b2 on Mac OS Mac OS X
    12. Gravatar Jeff UNITED STATES Says: Reply to this comment

      How do I get comments and rating stars on one line?

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.12 on Windows Windows XP
    13. Gravatar lhyfae CANADA Says: Reply to this comment

      Can’t thank you enough.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.13 on Windows Windows XP
    14. Gravatar Tendrillar Says: Reply to this comment

      I just can’t figure this out, I’ve tried it so many ways. I don’t know the first thing about code so it’s kind of blowing my mind.

      Am I missing a step between copying the code from Heloscan to posting it in between the {block:regular} part?

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.13 on Mac OS Mac OS X
    15. Gravatar barstool1 UNITED STATES Says: Reply to this comment

      Thanks for the help!

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.14 on Windows Windows 98
    16. Gravatar IN_RILIEVO UNITED STATES Says: Reply to this comment

      hi luke maciak,

      this definitely looks like a good tool. how does it compare with disqus?

      thanks…

      Posted using Flock Flock 1.2.4 on Windows Windows XP
    17. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      IN_RILIEVO said:

      how does it compare with disqus?

      Disqus is better. I have since switched to it and I’m very happy with it. I’d recommend Disqus over Haloscan.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.16 on Ubuntu Linux Ubuntu Linux
    18. Gravatar Mae UNITED STATES Says: Reply to this comment

      It works … however, it doesn’t update the comment post count — mine remains at “0″ comments even though I already have comments on there.

      Posted using Mozilla Firefox Mozilla Firefox 3.0.3 on Mac OS Mac OS X
    19. Gravatar Luke Maciak UNITED STATES Says: Reply to this comment

      @Mae: Yeah, it is a flaw that I noticed too.

      I have switched over to Disqus which is all in all a better system. I recommend you doing the same.

      Posted using Mozilla Firefox Mozilla Firefox 3.0.3 on Windows Windows XP

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <pre lang=""> <em> <i> <strike> <strong>

    [Quote selected]