How to change the comment link in your Blogger template

You can easily change the comment link at the bottom of your blog posts to read something different to "(n) Comments (where "n" is the number of comments). Instead, you could change it to say "Post your comments here", or even "Comments (4)", as I have done in this blog. This post explains how this can be achieved.






To change the text for your comment link, open the HTML editor for your blog template (Dashboard>Layout>Edit HTML), tick the "Expand widget templates" option, and find this section of code:

<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>

The parts we need to change are highlighted in red. This basically tells Blogger that if there is one comment, to write only "Comment" beside the number one, and if there are 0 or any other number of comments, to instead write "Comments" (the plural form). If you don't want to show how many comments you have for each post, and instead only want to write a new phrase (eg: "Post a comment"), you should replace the whole of the red section with your chosen phrase, like this:
<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'>Post a comment</a>

</b:if>

</b:if>

</span>

However, if you'd prefer to retain the number of comments in the link, you may prefer to rearrange the sections instead, like this:

<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'>Post a comment (1) <b:else/> Post a comment (<data:post.numComments/>)</b:if></a>

</b:if>

</b:if>

</span>

This will produce the following:
  • If there is one comment, it will read "Post a comment (1)"

  • If there are 0 comments, the link will read "Post a comment (0)"

  • If there are more than one comment, it will read "Post a comment (n) where "n" is the number of comments already present.

You can of course change the text to read anything you want. If you prefer not to have the brackets around the number of comments, simply remove them from the code.

I hope this tutorial has helped you better understand how to change the comment link in your posts. Please feel free to leave your own comments and opinions below!


0 comments:

Post a Comment