Add A New Random Post List Gadget To Your Blog

new random posts gadget blogThis 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=’’><img alt=’Best Blogger Tips’ src=’’/></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;}}
for(n in randarray){ var p=randarray[n];var entry=json.feed.entry[p-1];
for(k=0; k <; k++){if([k].rel==’alternate’){var item = “<li>” + “<a href=” +[k].href + “>” + entry.title.$t + “</a> </li>”;
<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 wist 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 !


  1. Hi is there anyway it can be make into a table of some kind?


  2. @ Dan Angel – It is in a list format you could probably set a width and height for the list to have it break into two columns.Is that what your looking for ?


  3. thanks a lot


  4. Squire’s SquadronAugust 6, 2011 at 7:45 AM

    Hi there Paul. Any way to change the picture for this button? And as much as I love your blog, I’d also appreciate a way to click it without going to yours!


  5. i want to ask that if i add this gadget then i should delete popular posts widget or not?


  6. @ syed tihaam ahmad – It’s up to you or if you have room for both on your blog.


  7. Hi!
    This is exactly waht i was looking for. thanx.
    (i think i over-use your blog)

    @ syed tihaam ahmad i don’t think u need to remove the popular posts gadget. from what i understand, the popular posts gadget will show the posts getting the most hits while in our case, the random posts gadget will show a random list of old/archived posts u’ve already written, keeping them relevant.
    I’d advise keeping tem both.
    but that’s just my opinion ;D


  8. Works like a charm…thanks Paul. You are the best