Make recent comments appear in your blogs sidebar

by Sai on December 15, 2008

Comments are the best way to know whether your post has been successful or not.

More comments you get,more the post has reached your audience.It also gives the scope to make any changes had anything gone wrong in your post before by seeing the comments.

Now if we come to the point of talk,first go to template then click edit HTML.(I’m talkin about blogger,blogspot blogs)

Find the closing head tag i.e.,  </head>

Now add the following code just before the closing head tag.

<script type=’text/javascript’> function commentDisplay(json) { for (var i = 0; i &lt; numcomments; i++) { var entry = json.feed.entry[i]; var alturl; if (i == json.feed.entry.length) break; for (var k = 0; k &lt; entry.link.length; k++) { if (entry.link[k].rel == ‘alternate’) { alturl = entry.link[k].href; break; } } alturl = alturl.replace(”#”, “#comment-”); if (entry.content) { comment = entry.content.$t; } else if (entry.summary) { comment = entry.summary.$t; } var re = /&lt;\S[^&gt;]*&gt;/g; comment = comment.replace(re, “”); document.write(’&lt;a href=”‘ + alturl + ‘”&gt;’ + entry.author[0].name.$t + ‘&lt;/a&gt; commented:&lt;br/&gt;’); if (comment.length &lt; numchars) document.write(comment + ‘&lt;br/&gt;&lt;br/&gt;’); else document.write(comment.substring(0, numchars) + ‘…&lt;br/&gt;&lt;br/&gt;’); } } </script>

Save your template for the moment.Go to page elements and click on any add a page element(gadget).

Click on text/html button and ad the following script.

<br/><script language=”javascript”>

var numcomments = 10;

var numchars = 100;

</script>

<script src=”http://sriraj46.wordpress.com/?feed=atom

alt=json-in-script&callback=commentDisplay”></script>

 

Here sriraj46 is the name of my blog and hence replace it with your blog.Suppose you blogname is xyz then replace that with   xyz.blogspot.com/posts/feeds/default.

thats it.Save it and view your blog.

Here 10 represents the number of comments and 100 is the character count in each comment.You can change it to a number of your liking.

 

Like the post? Then why not subscribe to sriraj.org and give us the pleasure of delivering future such posts right into your mail..

Visitors who read this article also read:

  1. Do blogs and sites really need sitemaps?Yes,thats the question to be asked.I would say yes but not mandatorily.If you have good interlinking among your posts then...
  2. Put an image in your sidebar and link it to a siteOh c’mon you’re looking for a way to put images in your sidebar.You know this one,i bet you do but...
  3. xml-sitemap error, make sure the file exists and is writableIf you got the above message when trying to implement the XML sitemap, then you have the solution here. I’m...
  4. What I think about InfolinksWhat about Infolinks makes me happy? The confidence that I’m working with a team that knows their business more than...
  5. Swap(exchange) blog title and post title for better SEOIn my previous post i have shown how to make your recent comments appear in your sidebar. Now let us...
  6. Make php and css files writable from within wordpressIf your using wordpress machine for your website or blog,you may sometimes be required to make certain changes or add...

{ 4 comments… read them below or add one }

Bill Bartmann

I’m so glad I found this site…Keep up the good work

mehraj

idid not get beep balance from last 2months & also my frd,s did not getting balance every month as we r playing ads contineously why please reply

sriraj

Mehraj,
you can clearly check how many hours are left until your next recharge gets activated. Generally, your application must be running for 720 hours to trigger your next recharge.
SMS beep status to 52288 to find how many hours are left for your next recharge.

mehraj

hai iam using airtel

Leave a Comment

Please tell us what YOU think. Copied comments will not be published. Any link to third party websites inside the comment box will either be edited or removed.

{ 1 trackback }

Copyright © 2008-11.Sai Digital Magazine.