Tuesday, 20 November 2012

How to display or show comment-author's profile image in Blogger/BlogSpot blogs

How to display or show comment-author's profile image in Blogger/BlogSpot blogs

Here's another useful tip for those bloggers, who are continuously trying to transform their free BlogSpot blogs into a pro-blog.
Through this hack, within 10 minutes you can start showing the images of commentators/comment-authors in your blog.
See the image below; how it will look after tweaking the HTML default code

How to display or show comment authors profile image in Blogger/BlogSpot blogs
To do so, first of all log in to Blogger
Now go to Layout, then click on Edit HTML tab.
Now Download the present template as a back up
Then click on "Expand widget templates"
Now search (CTRL+F) this
</head>
Immediately BEFORE IT, paste this:

<!--COMMENT-AUTHOR-PICTURE-STARTS--><script src='http://dsai.588.googlepages.com/blogger_comment_author_photos.js' type='text/javascript'/>
<script type='text/javascript'>
//<![CDATA[
addLoadEventundefinedfunctionundefined){showCommentPhotosundefined'commentphoto','comment-author', 1);});
//]]>
</script><!--COMMENT-AUTHOR-PICTURE-STOPS-->

NOW see this code below:

<dl id='comments-block'>
<b:loop values='data:post.comments' var='comment'>
<dt class='comment-author' expr:id='"comment-" + data:comment.id'>
<div class='commentphoto' style='float:right;'/>
<a expr:name='"comment-" + data:comment.id'/>
<b:if cond='data:comment.authorUrl'>
<a expr:href='data:comment.authorUrl' rel='nofollow'><data:comment.author/></a>
<b:else/>
<data:comment.author/>
</b:if>
<data:commentPostedByMsg/>
</dt>
<dd class='comment-body'>
<b:if cond='data:comment.isDeleted'>
<span class='deleted-comment'><data:comment.body/></span>
<b:else/>
<p><data:comment.body/></p>
</b:if>
</dd>
<dd class='comment-footer'>
<span class='comment-timestamp'>
<a expr:href='"#comment-" + data:comment.id' title='comment permalink'>
<data:comment.timestamp/>
</a>
<b:include data='comment' name='commentDeleteIcon'/>
</span>
</dd>
<div style='clear:both;'/>
</b:loop>
</dl>
In the code above YOU HAVE TO INSERT code lines shown in BLUE and BOLDED
And the red ones, are those which you can use as markers, BEFORE whom you have to paste the blue code lines.
You can change the position of pictures or images from Right to Light, by changing it in the first blue line in the code above...
Now whenever, people use their gmail or openid account to comment, then their pictures will be displayed alongside the comments !<>

No comments: