Show Comments

A while ago, when Blogger made one of their unannounced set of changes, the link at the bottom of each post that takes you to the comments started to jump to the comment form rather than the first comment. This meant that usually you ended up looking at the form without being able to see any of the comments. To see the comments you would then have to scroll back up the page to the find the end of the post and hence the first comment. I know that this really annoys me when I'm reading other peoples blogs, and so I thought I should at least attempt to fix my own blogs.

Unfortunately the layout tags don't include a link to the beginning of the comments, only date:posts.addCommentUrl which generates the link to the comment form. That link works by going to the #comment-form anchor. As the comments always appear before the form, we can insert another anchor with the same name, before the comments and then hey presto, the link will take us to the first comment instead of the form.

To make this change you need to edit the HTML version of your template (with the widgets expanded) and find the following HTML snippet
<a id='comments'/>
and replace it with
<a id='comments'/>
<a id='comment-form'/>
You should find that it appears twice in your template; once for threaded comments and once for unthreaded comments. Change it in both places to make sure you get the right one.

This works because the IDs of HTML elements are meant to be unique, and when they aren't the first one takes precedence. We could have made more changes to the template (change the comments to comment-form rather than adding the extra anchor, and remove the original comment-form anchor) but I decided it was safer to leave as much of the template alone as possible. Anyway you should now find that clicking the comment link takes you to the comments rather than the form which, as far as I'm concerned, makes more sense.

1 comments:

  1. Yes I had noticed and been irritated by that. Whether I shall have the courage to forage into my template and make the changes remains to be seen and probably depends on how well I go today in catching up with Blogland.

    ReplyDelete