Wednesday, May 28, 2008

How to Incorporate Haloscan Comments and Save Your Old Blogger Comments

The Blogger commenting system has long been the Achilles' heel of the Blogger platform. I prefer that people leave their name and URL if they have one instead of a ridiculous link to their profile, where you have to click around to find their blog (especially if they are a blogging addict like me). When I comment, I use the Name/URL field, but this practice hasn't caught on, as it is much more convenient to use the default Google/Blogger username since you've already logged in. And the Name/URL and Anonymous fields are enabled as a pair. Can't have one without the other. Not cool at all. Worst thing is the lack of a private email field.

Since I have so much history on this blog, I wasn't about to switch to a different comment system and lose all the comment history. And I'm not about to switch platforms either. That would be akin to rewriting code as opposed to re-factoring, which is just against my agile software nature (OMG, agile development has invaded my private life!). When my poor hubby got flummoxed over losing a comment (and I subsequently flipped out as well), enough was enough. I looked into Mr. Linky comments, which were not quite as elegant as I would have liked and then had a revelation where I could use Haloscan and still be able to preserve my old Blogger comments. Sometimes being a software engineer comes in handy. So here is the procedure with the magical HTML code that makes it all work.

  1. Sign up for a free Haloscan account (free is always good in my book).

  2. Click Install on the second toolbar. This procedure is only for the New Blogger templates.

  3. Make sure you have Display trackback code checked. Another Blogger deficiency with the lack of real trackbacks.

  4. Click Next. Follow the instructions here to the tee. Download your Blogger template and then browse to it so that it is displayed in the edit box.

  5. Click Upload Blogger Template.

  6. On the next place, click Download New Template. Again follow the instructions on this page. Don't worry about overwriting the original template, you've just downloaded it.

  7. Here is the new stuff. While you are still in the Layout > Edit HTML tab, make sure that Expand Widget Template is selected.

  8. Search for "end haloscan". You should be at the bottom of a section that starts with "start haloscan (part 1)".

  9. After the "end haloscan" comment, add this code (the first line should already be there):
    <!-- end haloscan -->

    <!-- special old blogger comments -->
    <b:if cond='data:post.numComments &gt; 0'>
    <a class='comment-link' expr:href='data:post.url'>
    <b:if cond='data:post.numComments == 1'>1 Previous <data:top.commentLabel/>
    <b:else/><data:post.numComments/> Previous <data:top.commentLabelPlural/></b:if></a>
    </b:if>
    <!-- end special old blogger comments -->




    If you have old blogger comments, a "1 Previous comment" or an "X Previous comments" link will appear after the Haloscan comment link. The previous comment link will not appear if you don't have old Blogger comments, so new posts will only show the Haloscan link. Clicking the previous comment link will open the post's permalink URL to display all the comments. It will no longer show the Blogger comment window (yes, that's the whole point!).




  10. Now search for "end haloscan" again twice. you should be at the bottom of the section that starts with "start haloscan (part 2 - post)". Scroll up a bit to verify this.



  11. After this "end haloscan" comment, add this code (the first two lines should already be there):




    <!-- end haloscan -->

    </b:if>

    <!-- special old blogger comments -->
    <b:if cond='data:post.numComments &gt; 0'>
    <h4>
    <b:if cond='data:post.numComments == 1'>1 Previous Comment:
    <b:else/>
    <data:post.numComments/> Previous Comments:
    </b:if>
    </h4>

    <dl id='comments-block'>
    <b:loop values='data:post.comments' var='comment'>
    <dt class='comment-author' expr:id='&quot;comment-&quot; + data:comment.id'>
    <a expr:name='&quot;comment-&quot; + data:comment.id'/>
    <b:if cond='data:comment.authorUrl'>
    <a expr:href='data:comment.authorUrl' rel='nofollow'><data:comment.author/></a>

    <b:else/>
    <data:comment.author/>
    </b:if>
    said...
    </dt>
    <dd class='comment-body'>
    <b:if cond='data:comment.isDeleted'>
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p><data:comment.body/></p>
    </b:if>
    </dd>
    <dd class='comment-footer'>
    <span class='comment-timestamp'>
    <a expr:href='&quot;#comment-&quot; + data:comment.id' title='comment permalink'>
    <data:comment.timestamp/>
    </a>
    <b:include data='comment' name='commentDeleteIcon'/>
    </span>

    </dd>
    </b:loop>
    </dl>

    </b:if>
    <!-- end special old blogger comments -->


    This code is for the post permalink where all the comments are displayed. The previous Blogger comments will be shown below the Haloscan comments.


After you've switched over the Haloscan, you will probably only have one post that may have both sets of comments. Here's my combination post. Any new comments on a post, new or old, will be recorded by Haloscan. And all your Blogger comments are still available. Perfecto!

No comments :

Related Posts Plugin for WordPress, Blogger...