Monday, 25 June 2007

How to install Haloscan trackbacks in Blogger templates

Unfortunately, Blogger chose not to include trackbacks in their new interface which can make it difficult for bloggers who want to cross reference their posts with other blogs. But luckily, there is a work-around as I mentioned in a previous post: installing Haloscan trackbacks in your blogger template.





Haloscan offer a commenting and trackback system which you can easily install in Blogger templates using their installation wizard. However, if you use this option, you also lose the ability to make and show comments made using Blogger's comment interface. For many of you, this may not be a problem, in which case go ahead and use Haloscan's installation wizard, which is the easiest method by far of installing trackbacks to your blogspot blog. You can even watch a video tutorial of this method here.

However, I prefer to keep Blogger's comment system and instead only use Haloscan's trackback function in my posts. There is some support for this in Haloscans forums and help files, but I've found it quite confusing, so I've posted my own method here which should help you get up and running quite smoothly, and include your post title (instead of those pesky numbers!) in the trackback URLs for your posts.

Here's what to do:

  1. Create your free account with Haloscan (if you haven't already done so). If you have more than one blog, you will need to create a different account for each blog.

  2. Customise the settings of how you would like your trackback links to be displayed in your Haloscan dashboard, including your blog name, timezone and such.
  3. Make a note of your Haloscan username as you'll need this to install trackbacks in your blogger template.

  4. Go to your Blogger dashboard and click on Template>Edit HTML. Before changing anything make a backup of your template by clicking "Download full template". Just in case you accidentally mess anything up!

  5. Now with the modifications: first, ensure that the "Expand widget templates" box is ticked.

  6. Just before the closing tag in your template, insert the following code, replacing "yourhaloscanusername" with your username:
    <script src="'http://www.haloscan.com/load/bloggerbuster'"
    type="'text/javascript'/">

  7. Now you need to add the trackback code in your post footer where you would like the trackback link to appear. You must be careful where exactly you place this code, otherwise when you try to preview your blog, you'll get a message telling you that the XML could not be parsed! Be sure to paste this outside any <b: if cond=...></b> loops:
    <a class='comment-link' expr:href='"javascript:HaloScanTB(" + "\"" +
    data:post.title + "\"" + ");"' target='_self'><script
    type='text/javascript'>postCountTB('<data:post.title/>');</script></a>

    I've included this code next to the comment link as follows:
    <span class='post-comment-link'><b:if
    cond='data:blog.pageType != "item"'><b:if
    cond='data:post.allowComments'><a class='comment-link'
    expr:href='data:post.addCommentUrl'
    expr:onclick='data:post.addCommentOnclick'><data:top.commentLabel/>
    <b:if cond='data:post.numComments == 1'>(1)
    <b:else/>(<data:post.numComments/>)
    </b:if></a> </b:if>
    </b:if><a class='comment-link'
    expr:href='"javascript:HaloScanTB(" + "\"" + data:post.title + "\"" + ");"'
    target='_self'><script
    type='text/javascript'>postCountTB('<data:post.title/>');</script></a>
    </span>

  8. Preview your template to make sure everything looks okay. You should see the trackback link in the footer of your posts.

  9. If all looks okay, save your template and enjoy your new trackbacks feature!

To send trackbacks to other blogs, you'll need to log into your Haloscan dashboard and click on "Manage Trackback>Send a trackback ping. Insert your blog name, the full URL of your blog post, an excerpt from your post and the trackback URLs you want to ping (each on a different line). Once you've pressed "send" you'll be notified of the success/failure of your pings. Usually, trackbacks are only unsuccessful if you haven't used the proper trackback URL of the post you are pinging.

And there you have it: trackback functionality for Blogger blogs! Let's just hope that the guys at Blogger decide to include trackbacks by default in the future so we won't need to use complicated workarounds!

Technorati Tags:

No comments:

Post a Comment