February 29, 2008

How to switch your comments from Blogger to Haloscan or backwards and not lose your existing comments

Not really anthropological-related, but I was looking for a way to switch the comments on the blog from Haloscan to Blogger and not lose all the existing past comments. As far as I could tell there is no "clean" way to achieve this, so this is my work-around.

First of all, if you just replaced the haloscan code in your template with the blogger code, this would result in all your previous posts having new blogger comments. So, that solution is out.

I simply created a new user account for posting in my blog, whose blogger profile name is "dienekesp" rather than "Dienekes". Now, when I post as "dienekesp", the <$BlogItemAuthor$> tag takes the value "dienekesp".

Next, you place both the haloscan comment-generating code, and the blogger comment-generating code in your template, and you "comment out" the code you don't want to use by two simple JavaScripts:

<script type="text/javascript"><!--
if ("<$BlogItemAuthor$>"!="Dienekes")
document.write("\< !--"); //-->

</script>

BLOGGER COMMENT CODE

<script type="text/javascript"><!--
if ("<$BlogItemAuthor$>"!="Dienekes")
document.write("--\>");
//-->;

</script>

The same code as above should also be repeated for the Haloscan comments code, but with "dienekesp" instead of "Dienekes". So, from now on whenever I post as "dienekesp", Blogger comments will be used; when I post as "Dienekes", Haloscan comments will be used. All the older posts which had been posted as "Dienekes" will retain their existing comments.

PS: It goes without saying that this trick is provided as-is with no guarantee that it will work or acceptance of responsibility if it doesn't or you wreck your blog in your process. Make sure you back up your template in advance.

4 comments:

Crimson Guard said...

Blogger is somewhat of a pain though.

Crimson Guard said...

PS

Any idea of who where the spammers?

George said...

Bravo to Dienekes for switching to Blogger. Now I can open up the comment in Firefox tabs, rather than new windows. Well done.

Ishan .... said...

One of the main feature of using third party comment system is Reply option to comments which blogger lack.
I recently saw this tutorial on How to add reply option to blogger comments and thought to share with you