The Best Random Posts Widget For Blogger Blogs

The Best Random Posts Widget For Blogger BlogsAlthough “Related Posts Widget” and “Popular Posts Widget” are important for all types of blogs, but in blogs where almost all the posts are similar (like blogs with articles on recipes, money-making, computer tricks or automobiles etc.), visitors usually do not mind reading some quite-unrelated posts too. So along with Related Posts widget, a “Random Posts widget” on your blog will help you to increase the number of page impressions.

Adding a Random posts widget is very easy…
Simply log in to Blogger, go to Layout, click on “Add a Gadget“, and select it as “HTML/JavaScript” type.

And finally paste this code in to it:

<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>

Edit the code shown in ‘red’ to change the number of posts being displayed in the widget.
Now save the widget, and place it somewhere so that it is clearly visible to the visitors !

The Best Random Posts Widget For Blogger Blogs

Thanks to Blog Godown for this widget. Visit this blog to display the same widget along with summaries.
Image credits: AndApps

Leave a Reply

63 Comments on "The Best Random Posts Widget For Blogger Blogs"

Notify of
avatar
Sort by:   newest | oldest | most voted
Martin
Guest
Hi Mr Sai This is a little bit off topic, but I was wondering if you could help me with a query? Is there any way when building a site on the blogger platform to include within a post a "browse box"? Something where you anybody visiting the site could click on a browse button within the post and then can browse to a particular folder / file on their hard drive and upload a picture, word doc or other file? Obviously, if this can be done, any file uploaded would have to be able to go to some part… Read more »
Divya Sai
Guest
Hello Martin, Yes that is certainly possible, check out this page for a live example:http://bloggerstop.net/2008/09/contact-us.html(see the second form-to send templates/any file to me) In one of my posts, I have given the instructions to add a contact me page to blogger blogs. So by using the same method, while creating your "Contact Form" select to show only "one field" in the form, which is a "file attchment" type. Once you register there and start creating your form, you'll understand what I am saying. But by this method, whatever files are uploaded by your readers will be mailed to you, so… Read more »
LeBlogger
Guest

VERY VERY good widget, thanks a lot for this Divia

View Comment
LeBlogger
Guest

I'll try to show images on the widget too if i got some time

View Comment
sinarhairan
Guest

Dear Sai,
I am having trouble with with my post that has not been updated since jun. When I check my blog status the last message appear like this.

(Friday, June 12, 2009 Blogger will be unavailable Monday (6/15) at 12:00AM PDT for about 10 minutes for maintenance.)
So what do I do to solve the problem because my blog list will not be updated to all my friends blog.
Tq.
Brianpedro

View Comment
vinoth
Guest

The link u give is a autoblogger…
watch closely,he has just taken the feedburner E-mail delivery and he is posting by mail..HE has not even removed unsubscribe in some posts….you should not encourage this type of .people…remove that do-follow link..u are encouraging a plagiarism blog.
see the title from the archive ..you will understand..

Original source is here
http://hack-genius.blogspot.com/2009/07/random-post-widget-for-blogger.html

View Comment
Ms Hetal Patil
Guest

Sai Ramji Divya,

I was badly needing this widget. I will certainly use this widget.

Thanks a lot

Hetal Patil

View Comment
gautam
Guest

Divya Sai looks like the place you got it from was also a content stealer because theoriginal code is here Random Posts Blogger Widget. http://www.bloggodown.com/2009/04/random-posts-blogger-widget.html

View Comment
Manish
Guest

Hi divya…

Nice article….

Actually i had some questions.. Slight off topic…sorry

I have a blog at http://entrance-corner.blogspot.com/

but the problem is whenever any one searches or clicks on the labels category….the results arent given in a proper way….

u can check it out…try clicking on any labels….on my blog

Please tell me how to modify the search results page in blogger….like yours…how you have done it…?

i searched the whole "world wide web" but coulndt find any

I request you to please post something related to it….or give me the solutions for it.. comment image

View Comment
Martin
Guest
Hi Divya Thank you for pointing me towards your own contact page and the e-mail me form website (I have previously used webformdesigner.com which does not provide captcha, nor the "browse box" function). Thank you too for your kind comments about my privacy policy! Sorry to stay off topic here but can you please clarify (because I cannot find the answer to this on the e mail me form website) – to build the form with that browse box, is that possible using the free service, or did you have to subscribe to one of their paid services? Thank you… Read more »
Se7enTime
Guest
Divya Sai
Guest

@ Vinoth @ Gautam
Thanks a lot guys for directing me to the original source, I have just updated and corrected the post.

@Manish
Here's the tutorial (It'll solve an important SEO purpose too):
http://bloggerstop.net/2009/01/show-only-titles-in-blog-archives-with.html

@Martin
It's all free, simply register and start making your forms(you can make multiple forms), simply give it a try, I am sure you'll like their service.

View Comment
Divya Sai
Guest

@ SinarHairan

Couldn't get your point…Your feed is working fine(as displayed in your "My Headlines" widget)

Moreover all the posts are getting indexed too by Google:
http://www.google.com/search?q=site%3Asinarhairan.blogspot.com

The Blog status message is actually not just specific to your blog, but it is for everyone hosted on Blogger. So don't worry about those messages, they are usually temporary and blogs go down for just around 10-20 minutes.

View Comment
billjac
Guest

There are a lot of random posts gadgets out there, but yours is the one that works the way I want it to. Thanks!

View Comment
DAF
Guest

Hi…..THANK YOU ………..

View Comment
Reza Winandar
Guest

Anyway, blogger is the most customizable blog platform in the world. Do you agree with me?

Reza Winandar from Blogger Make Money

View Comment
Matt
Guest

Hi the widget works great! I have a question though. How do I change the color of the links? I have a dark background and the links appear dark and it is hard to see. Thank you for your time.

http://swwildspace.com/

View Comment
Divya Sai
Guest

@Matt

In your template, you'll find this:

.tabdiv li {
list-style-image: url("star.png");
margin-left: 20px;
}

just below it, add this:

.tabdiv li a {
color: red;
}

NOTE: Instead of "RED", you may use any html-hex code by adding the code with a # prefix.

View Comment
Matt
Guest

Thank you very much for your help!

View Comment
wpDiscuz