Wednesday, November 08, 2006

Getting Haloscan to work in Blogger Beta

NOTE: These instructions appear to have been broken when Blogger Beta un-Beta-rized. I have had 2 or 3 reports of people failing to successfully implement them, of course it may only be for one or two template layouts, but I'm not to know

So try the following but try and understand what you're doing at each stage rather than blindly following orders.

ORIGINAL POST:

http://logicalphilosopher.blogspot.com/2006/09/getting-haloscan-to-work-in-beta.html

Deserves most of the credit for my working solution. The solution above is a bit buggy in that it doesn't handle single and multipost comments very well.

Which is where I come in.

Here is what you need to do to get Haloscan happily accepting 3000 character comments from your adoring blog-readers. WITH TRACKBACK. w00t.

NOTE: Due to HTML constraints and the Planck Constant, the HTML code isn't provided with indentation, so feel free to indent as much as you feel necessary. I would also advise you to use an external tool such as Notepad2, GEdit or Smultron (depending on your OS) when editing and finding stuff

  1. Sign in to Blogger Beta
  2. Goto Dashboard > Your Blog > Template > Edit HTML
  3. Select the Expand Widget Templates marker
  4. Find:
    <b:includable id='comments' var='post'>
    and delete everything after that tag and up to the next
    </b:includable>
    but keep those two mentioned tags. This will have the effect of stopping Blogger comments appearing. Make sure you don't overshoot otherwise you'll wreck your Template
  5. Delete:
    <b:include data='post' name='comments'/>
  6. Delete:
    <dl class='comments-block' id='comments-block'>
    <b:loop values='data:post.backlinks' var='backlink'>
    <div class='collapsed-backlink backlink-control'>
    <dt class='comment-title'>
    <span class='backlink-toggle-zippy'> </span>
    <a expr:href='data:backlink.url' rel='nofollow'><data:backlink.title/></a>
    <b:include data='backlink' name='backlinkDeleteIcon'/>
    </dt>
    <dd class='comment-body collapseable'>
    <data:backlink.snippet/>
    </dd>
    <dd class='comment-footer collapseable'>
    <span class='comment-author'><data:post.authorLabel/> <data:backlink.author/></span>
    <span class='comment-timestamp'><data:post.timestampLabel/> <data:backlink.timestamp/></span>
    </dd>
    </div>
    </b:loop>
    </dl>
  7. Delete:
    <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'><b:if cond='data:post.numComments == 1'>1 <data:top.commentLabel/>
    <b:else/><data:post.numComments/> <data:top.commentLabelPlural/>
    </b:if>
    </a>
    </b:if>
    </b:if>
    </span>
  8. Find:
    <div id='main-wrapper'>
    <b:section class='main' id='main' showaddelement='no'>
    <b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>
    <b:includable id='postQuickEdit' var='post'>
    <b:if cond='data:post.editUrl'>
    <span expr:class='item-control " + data:post.adminClass'>
    <a expr:href='data:post.editUrl' title='Edit Post'>
    <span class='quick-edit-icon'>
    </span>
    </a>
    </span>
    </b:if>
    </b:includable>
    And paste
    <a name='comments'/>
    <b:if cond='data:post.allowComments'>
    <script src='http://www.haloscan.com/load/XXXX' type='text/javascript'>
    </script>
    <a expr:href='javascript:HaloScan(" + "\"" + data:post.id + "\"" + ");' target='_self'>
    <script type='text/javascript'>postCount('<data:post.id/>');
    </script>
    </a>
    <a expr:href='"javascript:HaloScanTB(" + "\"" + data:post.id + "\"" + ");"' target='_self'>
    <script type='text/javascript'>postCountTB('<data:post.id/>');
    </script>
    </a>
    </b:if>
    before the </b:includable> but after the </b:if>.
    Replace XXXX with your Haloscan username
  9. !!!OPTIONAL!!! Only if you have previously tried hacking it with the top link, delete:
    <span class='post-comment-link' >
    <b:if cond='data:blog.pageType != "item" '>
    <b:if cond='data:post.allowComments'>
    <script src='http://www.haloscan.com/load/XXXX' type='text/javascript'>
    </script>
    <a expr:href='"javascript:HaloScan(" + "\"" + data:post.id + "\"" + ");"' target='_self'>
    <script type='text/javascript'>postCount('<data:post.id/>');</script></a>
    </a>
    </b:if>
    </b:if>
    </span>
  10. !!!OPTIONAL!!! Have fun with your Haloscan comments