How to Highlight author comments in Blogger

Update Jan 17th 2012: now uses simpler code.


Update January 18th 2012: A new and easy to install threaded commenting hack version 2 includes this hack's functionality, you might consider using it.




There are some highlight author comments hacks out there, but most I've seen check only that comment author name is something. It is better to check the author url (so anonymous user's won't disquise as you so easily), which my hack does. But it is easiest to use the variable "data:comment.authorClass" – for blog authors it is set to "blog-author", and we can check that. Basically my hack puts all "user comments" into div with class "normal-comment", and "admin comments" into div with class "admin-comment".



Edit your template html. Select Expand Widget Templates. Find line:

          <b:loop values='data:post.comments' var='comment'>

After that add:



Data provided by Pastebin.com - Download Raw




Remember to change the url between the &quot;s to your profile page url. In the old code you needed to change the url, in this new code you don't have to change anything. Then find lines:

                <b:include data='comment' name='commentDeleteIcon'/>
</span>
</dd>

(you can search using the first line). Just after those lines add:

            &lt;/div&gt;

Then save the template. Now we need only to style the admin-comment to look different. Go to Template Designer, choose Advanced, Add CSS, and add following:

.admin-comment {
background: #F4F4F4;
margin-top: 6px;
margin-bottom: 6px;
padding: 3px 3px 0 3px;
border: 1px solid #EDEDED;
}

And then to the testing. You can style admin-comment background otherwise, if you like, using CSS. I have installed this hack on this blog.