Thursday 17 September 2009

Show avatars on Blogger Comments

Blogger is now introducing features every day as part of its 10th birthday celebrations.Now it has formally announced the Blogger Comment avatars. To know what it means take a look at the comments here on this blog and you will see the profiles pictures of the commentators near to the comments.If you are using some default blogger template things would be much easy.Here is a little screenshot of the new feature.

Implementation of Comment Avatars

1.First of all Go to Blogger > Settings >Comments and enable “Show profile images on comment”

2.Now if you have a normal un customized template you will see the avatars on the comments on your blog.

3.If you have a customized template you will have to add some codes and play around with your template.For that first go to Blogger Layout >Edit HTML and backup your template.

4.Expand the widget templates and check if you can find this line there

<dl expr:class='data:post.avatarIndentClass' id='comments-block'>



If you can’t then that means we have something to do..



If you couldn’t find this,then do the following steps.



a)Find




<dl id='comments-block'>



and replace it with




<dl expr:class='data:post.avatarIndentClass' id='comments-block'>



b)Now Find all occurrences of




<a expr:name='data:comment.anchorName'/>



and replace each of it with




<b:if cond='data:comment.favicon'>
<img expr:src='data:comment.favicon' height='16px' style='margin-bottom:-2px;' width='16px'/>
</b:if>
<a expr:name='data:comment.anchorName'/>
<b:if cond='data:blog.enabledCommentProfileImages'>
<div expr:class='data:comment.avatarContainerClass'>
<data:comment.authorAvatarImage/>
</div>
</b:if>



If you are using the author comment highlighting trick and if doesn’t work out with that trick,then leave a comment and i will try to help you out..



Further Styling.







If you want to add a default avatar for the ones with no profile pics,then place the CSS code just above




]]></b:skin>



CSS Code




.avatar-image-container {background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjrNZkaSGAeP7wfh1UzHXXWNnli1Q4KkssTSGnX0Pzrc-JBi1hV8_cmbPo6ArzrkQxwGckNM8IHQ3b3SfcYHBLwchWdTgLZxSgfq2z6QBIQCYhPZu6cR-Gpm28UvUSHYNJFTjI9_3fug/s400/default.gif); width:35px;height:35px; }
.avatar-image-container img { border:none;}



You can customize the CSS according to what you need.



If you need bigger avatars instead of smaller ones,then use the following CSS instead of the one above.




.avatar-image-container{width:50px;height:50px;margin-top:-5px;}
.avatar-image-container img {background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuerQ3UmmeTPwkWEA4m90FPpidUTDsp2NH5zsdmkECpdMzaQmzLqqKI8BmFIwUxc1y6EM1adiwBTgaVWH1Fauq4vM90f1uSxf7lUfjDWRe5mt42uiPKL0gv_bq1-G34BwfuJhPdfjg7FE/s400/grav.png);width:50px;height:50px;}



This will give you a bigger avatar and also a default gravatar image but it has a little drawback.It will also resize the small blogger favicons to a big size.(blooger favicon is displayed when a blogger user doesn’t have a profile avatar.Similarly OpenId also has a similar small icon.. ).



BTW to set you avatar pic you can use two methods.You can choose the edit profile link on your blogger profile and upload an image there,The second method is to enter a blogger comment somewhere in any blogger comment form and then click the Preview button instead of the Post Comment button.Now you will see an option to upload your avatar.



In case anything bad happens restore the template backup.. and comment here..:)


Permalink: Show avatars on Blogger Comments


Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Show avatars on Blogger Comments"

Post a Comment