Wednesday, 1 November 2006

Comment Notification and Author Comment Highlighting

I now have some hacks for the comments section - a hack to highlight your comments as the blog author and another to notify your readers when you respond to their comment.

I recently found a hack by Ramani over at Hackosphere. This is a two for one hack. This one really makes sense and is extremely helpful to all concerned.

It is helpful to the person posting a comment on someone else's blog because they will get an email notification when there is a response to that comment by the blog owner. How many times have you written a comment on a blog, and forgot about it or couldn't remember the blog you commented on?

It is helpful for the owner of a blog because many times a response to a comment is lengthy and involves research. Especially for blogs such as mine. Believe it or not, I read all comments and attempt to help all inquires for assistance. For me, it can be very time consuming. When I finally get the answer posted, I know that the person will be notified of my response.

As for the highlighting, it simply makes it easier to find the blog owner's comments in the list.

Read Ramani's instructions. If you need more explanation I'm outlining the steps below with a little more detail for how to:

In your style sheet find this:

.comment-body {
margin:0;
padding:0 0 0 20px;
}
.comment-body p {
font-size:100%;
margin:0 0 .2em 0;
}
and add this:
.comment-body-author {
margin:0;
padding:0 0 0 20px;
}
.comment-body-author p {
font-size:100%;
margin:0 0 .2em 0;
color:#CC3300;
text-decoration:bold;

}
This changes the blog owner's comment color and font type. The code in red is where you can change it from bold to normal or italics, and the color from this (which happens to be red) to whatever color you like.

Next open you template/edit HTML and check the little box above the editing window that says "Expand Widget Templates". Then look for:
<dl id="comments-block">
<b:loop var="comment" values="data:post.comments">
<dt class="comment-author" id="'">
<a name="'">
<b:if cond="data:comment.authorUrl">
</b:if></a><a href="data:comment.authorUrl" rel="nofollow"><data:comment.author></data:comment.author></a>
<b:else></b:else>
<data:comment.author></data:comment.author>
</dt></b:loop>
<data:commentpostedbymsg></data:commentpostedbymsg>

<dd class="comment-body">
<b:if cond="data:comment.isDeleted">
<span class="deleted-comment"><data:comment.body>
</data:comment.body></span>
<b:else></b:else>
</b:if><p><data:comment.body></data:comment.body></p>

</dd>
<dd class="comment-footer">
<span class="comment-timestamp">
<a title="comment permalink" href="http://beta.blogger.com/">
<data:comment.timestamp></data:comment.timestamp>
</a>
<b:include name="commentDeleteIcon" data="comment"></b:include>
</span>

</dd>

</dl>
and replace with this code:
<dl id="comments-block">
<b:loop var="comment" values="data:post.comments">
<dt class="comment-author" id="'">
<a name="'">
<b:if cond="data:comment.authorUrl">
</b:if></a><a href="data:comment.authorUrl" rel="nofollow"><data:comment.author></data:comment.author></a>
<b:else></b:else>
<data:comment.author></data:comment.author>
</dt></b:loop>
said...


<b:if cond="data:comment.author == data:post.author">
<dd class="comment-body-author">
<p><data:comment.body></data:comment.body></p>
</dd>
<b:else></b:else>

<dd class="comment-body">
<b:if cond="data:comment.isDeleted">
<span class="deleted-comment"><data:comment.body>
</data:comment.body></span>
<b:else></b:else>
</b:if><p><data:comment.body></data:comment.body></p>
</dd></b:if>

<dd class="comment-footer">

<span class="'">
<form action="http://www.anniyalogam.com/scripts/notify.php" method="post" target="_blank">
<input value="data:comment.authorUrl" name="profile" type="hidden">
<input value="data:post.author" name="nickname" type="hidden">
<input value="data:post.title" name="post_title" type="hidden">
<input value="data:post.url" name="post_link" type="hidden">
<input src="http://www.anniyalogam.com/1clickbutton.png" type="image">
</form>
</span>

<span class="comment-timestamp">
<a title="comment permalink" href="http://beta.blogger.com/">
<data:comment.timestamp></data:comment.timestamp>
</a>
<b:include name="commentDeleteIcon" data="comment"></b:include>
</span>
</dd>

</dl>
Now when you open a post page (that is the page that comes up when you click on a post title) you will see a little icon after each post. (Note, it does not show on the page where you actually type the post!) When you click on a person's post that you have responded to, an email will be sent to them saying a response has been posted to their comment. This only works if the commentor has enabled "Show my Email Address" in their 'User Profile'.

I love this hack! I only wish more bloggers would enable "Show my Email Address"!!!

post signature

No comments:

Post a Comment