Continued from How to add Blogger Beta Search Box
Old design, new trick
It took me all night to port my old blog design, a day after Blogger Buzz announced that it opened Edit HTML. Some of my old tweaks are incompatible, like the custom comment form, and photo favatar. If I have the time, or if inspiration strikes me, I shall look at what can be done.
One of those which surived (albeit transformed), is the correct grammar comment count tweak.
The original correct grammar hack was first written last January 2005 by the anonymous author of
Blogger Templates. It was a simple workaround involving replacement of 1 comments to 1 comment.
1. If comment is zero, it should display 0 comments.
2. If comment is one, it should display 1 comment.
3. If comment is more than one, it should display [how many] comments.
Finding the Blogger Beta Comment Links
In the Post Pages
In the Main, or Archive page:
The Comment Count Tags Explained
<b:if cond='data:blog.pageType != "item"'> is a conditional tag. Anything enclosed inside this tag will be displayed on the main or archive pages of your blog. In simpler terms, anything enclosed will not be shown in the post pages. It replaced the now obsolete <MainOrArchivePage> of the pre-beta blogger.
<b:if cond='data:post.allowComments'> is another conditional tag. If you allow comments, anything enclosed will be executed.
</b:if> is the closing element for conditional tags.
a is an anchor for a link. expr is a shorthand for expression. href is the target pointer. data: is the standard blogger beta layouts tag. post.addCommentUrl is the url if you're adding comment in your post. onclick is an expression that will execute when you click the link. post.addCommentOnclick will add comment on your post if you click on the link.
<data:post.numComments/> is a post comment tag. The number of comment(s).
<b:if cond='data:post.numComments == 1'> is another conditional tag. This tag states that If the number of comment in the post is equal to 1.
<data:top.commentLabelPlural/> is a post label tag, particularly a plural comment label. This reads in browsers as Comments.
The easiest port which comes to my mind when I found out the new if/else conditional tag of Blogger Beta, is the correct comment count.
The basic conditional code is already laid out by the Blogger Development Team. It's just a matter of making sure the three conditions of the former hacks of Aditya Mukherjee and Annie Bluesky is met.
Nevertheless, it still took me at least an hour of trial and error before I came up with a working code. Here are some things I learned from the process:
1. Standard programming equations like ==, !=, >, < works.
2. Conditions can still exist inside <b:else/>, for example, I've tried displaying BOTH ==1 and >1 at the same time, and it works!
3. Sandwiching using one line tag like <b:else if cond... do NOT work.
4. Nesting using different tags, however works <b:else/><b:if cond...
To Fix the Comment Count
1. If you've haven't migrated to Blogger Beta, see my instruction on how.
2. Click Edit HTML.
3. Find this code (This will occur twice on the standard Blogger templates):
4. Replace the code with this (If you're using a standard template like Minima, replace twice.)
5. Click Save Template.
Just replace 1 comment or Reply to this Post, or comments, with your prefered words.
For example this blog uses Be the first to comment, instead of Reply to this post
That's it! Hope you implemented it well. If you have some questions or suggestions, leave a comment here, and I'll get back to you as soon as I can.