2009年4月25日星期六

How do I reply to comment on Blogger blogs?

Hey! Blogger have launched its official threaded commenting feature, why not to try it now


If you can read Chinese, there are more detailed instructions on how to add these codes into your Blogger template.

Update @ Sep 4th, 2011:
Thanks to Sophie, I found that all html tags in this post are ruined by Blogger Post Editor - I just edited this post a little, and it replaces every "<>" tag to "&lt;&gt;" unexpectedly - this is not the first time it happens. The replacement simply makes this trick out of action.
For those who're experiencing problems applying this hack during August to September, I'm sorry for my mistake, please apply the corrected code again to your blog.
Thanks for all your comments (also emails and supports)!
Update @ August 13, 2011:
I used to use 'https://www.blogger.com/comment.g?***' to redirect readers to comment page, since Blogger removed the SSL feature of the comment page, I suggest to replace the 'https://' address with 'http://'. This will, evidently, speed up the page loading time. However, 'https://' is still working (at least for now).

I have seen lots of people who maintain their blogs on Blogger platform wants to know how to reply to comment with a single-click just as WordPress blogs do, so I wrote a slice of code, wish this would help those who want a [Reply to comment] link right after each comment.

For Blogger Layouts:
Log in to Blogger Dashboard, go to Layout - Edit HTML, then check Expand Widget Template.
You can search for this tag <data:commentPostedByMsg/>, add the following codes after it:
<span class='comment-reply'><a expr:href='&quot;https://www.blogger.com/comment.g?blogID=YOUR-BLOG-ID&amp;postID=&quot; + data:post.id + &quot;&amp;isPopup=true&amp;postBody=%40%3C%61%20%68%72%65%66%3D%22%23&quot; + data:comment.anchorName + &quot;%22%3E&quot; + data:comment.author + &quot;%3C%2F%61%3E#form&quot;' onclick='javascript:window.open(this.href, &quot;bloggerPopup&quot;, &quot;toolbar=0,location=0,statusbar=1,menubar=0,scrollbars=yes,width=400,height=450&quot;);return false;'>[Reply to comment]</a></span>
You should replace YOUR-BLOG-ID with your blog ID, it can be found in your Blogger Dashboard URL, for instance, http://www.blogger.com/posts.g?blogID=12345678

Click Save Template, then have a look, you'll find [Reply to comment] after each of your blog comments. Click this link, it will return:
<a href="#c1234567890">Comment Author</a>
Submit your comment, you'll get a link directly to the comment you supposed to reply.

For Blogger Template:
This will be a little complicated.
Place these before </head> in your template code:
<ItemPage><script type="text/javascript">var postId = "<Blogger><$BlogItemNumber$></Blogger>";</script></ItemPage>
Find the place you want to place [Reply to comment] link, for example, after the tag <$I18NCommentAuthorSaid$>, paste these codes:
<span id="reply-<$BlogCommentNumber$>" title="Reply to comment"></span>
<script type="text/javascript">
var commentAuthor = '<$BlogCommentAuthor$>';
var commentAuthor = commentAuthor.replace(/<[^>].*?>/g,"");
var commentAuthor = escape(commentAuthor.replace(/ /,""));
document.getElementById("
reply-<$BlogCommentNumber$>").innerHTML = "<a href=\"https://www.blogger.com/comment.g?blogID=YOUR-BLOG-ID&amp;postID=" + postId + "&amp;isPopup=true&amp;postBody=%40%3C%61%20%68%72%65%66%3D%22%23<$BlogCommentAnchorName$>%22%3E" + commentAuthor + "%3C%2F%61%3E#form\" onclick=\"javascript:window.open(this.href, \'bloggerPopup\', \'toolbar=0,location=0,statusbar=1,menubar=0,scrollbars=yes,width=400,height=450\'); return false;\">[Reply to comment]</a>";
</script>
Save Template.

I hope all of you could like this trick. If you have any further problems or doubts, please leave them and your blog url in comments, thank you all.