post list

Add A New Random Post List Gadget To Your Blog

random Posts

This post has been rewritten on 22-09-10 to include a new improved random post gadget. The previous gadget had stopped working. Thanks to Sylvia from Classical Bookworm for the heads up.

Most blogs have Recent Post and maybe Popular Posts gadgets in the sidebar and footer and these help keep readers on you blog and display some of  your best posts. But only the random posts gadget really digs deep into your archive and helps keep those old posts rotating. Adding the Random Posts Gadget will only take a minute so lets look at the steps.

Add A Random Posts Gadget To Your Blog

Step1. In your dashboard click ‘Design’ > ‘Add A Gadget’

Step 2. Choose Html/Javascript Gadget and paste the following code into the area provided :

<a href='http://www.spiceupyourblog.com'><img alt='Best Blogger Tips' src='http://3.bp.blogspot.com/_rKG-ziTSNUQ/TQ5eV0U0EiI/AAAAAAAACik/xo2eFaDbfrE/s1600/best+blogger+tips.png'/></a><script type="text/javascript">
var randarray = new Array();var l=0;var flag;
var numofpost=6;function randomposts(json){
var total = parseInt(json.feed.openSearch$totalResults.$t,10);
for(i=0;i < numofpost;){flag=0;randarray.length=numofpost;l=Math.floor(Math.random()*total);for(j in randarray){if(l==randarray[j]){ flag=1;}}
if(flag==0&&l!=0){randarray[i++]=l;}}document.write('<ul>');
for(n in randarray){ var p=randarray[n];var entry=json.feed.entry[p-1];
for(k=0; k < entry.link.length; k++){if(entry.link[k].rel=='alternate'){var item = "<li>" + "<a href=" + entry.link[k].href + ">" + entry.title.$t + "</a> </li>";
document.write(item);}}
}document.write('</ul>');}
</script>
<script src="/feeds/posts/default?alt=json-in-script&start-index=1&max-results=1000&callback=randomposts" type="text/javascript"></script>

Note : You can change the number in red to choose how many posts you list to have displayed.

Step 3. Give the gadget a title, Like : ‘Random Posts’, ‘Posts From The Archive’ etc.. Save The Gadget.

You have just added a cool new way for people to navigate your blog, make sure to check out some more great Blog Gadgets you will love !

Comments And Questions Welcomed Below.

What My Robot Recommends:

Add A New Random Post List Gadget To Your Blog
Informative
85
Useful
90
Easy To Read
89
Fact
89
Reader Rating0 Votes
0
88