Improved Random Post Link Widget for Blogger

The complete instructions and new code for the random post link have been moved to Experiment Garden. Instructions in this post may be outdated, so please see the new version.

The random post link addon for Blogger has now been updated to better and faster than ever before.

Basically this script creates a text link to a random post on your blog. It displays the random post's title as well as a brief random message to accompany it.

The major changes between this updated version and the current version are:

The addon no longer requires the Archive Widget to be added to your page.
The code is no longer limited to displaying posts from the past three months. It can now give you links to posts from your blog's entire history.

You can see the code in action at the top of the post area here at Inkweaver Review. Just refresh the page a few times to see a variety of random links to posts I've written in the past.

Removing Inkweaver Review Advertisment

You may notice that about one out of every ten random links is not to a blog post but back to Inkweaver Review. I would appreciate it if you left this, as it shows appreciation for the time and effort that I went to to create this script. However, you may not like the effect. There are two options you might want to take.

First, you can make the advertisement appear less often by simply adding more of your own custom messages to the list of random messages.

Find the section of code:
var introArray = new Array(
"Have you read ^?",
"Check out ^.",
"Look at ^.",
"Just for you: ^",
"Please look at ^.",
"Would you like to read ^?",
"You might enjoy reading ^.",
"Do you want to read ^?",
"Please read ^.",
"Random link powered by <a href="http://inkweaver-review.blogspot.com/"></a>"
)

To add another message just copy one of the lines in the middle, and paste it again in the middle. If you want to customize the message, just keep in mine that the caret "^" is where the random link is inserted.

If you want to remove the link back to Inkweaver Review completely, just remove the last message in the list. After you remove this message, be sure to remove the comma at the end of the new last message. If you remove the link back to Inkweaver Review then please add another link somewhere. Perhaps add me to your blogroll, or else write a post about the addon with a link to this page.

Limiting Number of Posts Used

Another customization that you may want to do is limiting the number of posts that the script can choose from. As it is the script will display links to any of your posts up to the 99999th post. You may want to limit it to the last 100-200 posts for several reasons. For one thing your oldest posts might be out of date, or their writing quality might not be as good as your new posts. But another reason why you might want to reduce the number of posts is load time. Loading a list of all the posts you have ever written on the blog can be time intensive for older blogs. So to reduce the number of posts that the script will choose from find the number 99999 in the code that you added to the XML template and change it to a smaller number. For example, the number 100 will limit the results to the last 100 posts that you have written.

I sincerely hope that this Blogger addon can be of help to you. If you encounter any issues please let me know by commenting here, and I will do my best to get back to you as soon as possible.

Your Rating:
Inkweaver Review 2009-04-20T15:42:00-05:00

27 replies so far. What are your thoughts?

Shan said...

excellent dear

NathanKP said...

I'm glad that you like it. If you have any problems with it left me know.

selenakyle said...

brilliant! just what i need!
thank you! (i'm keeping your advertisement).

NathanKP said...

Thank you very much Selena. I hope that it works well for you.

If you have any questions or problems installing the code, just ask them here.

Nathan

dennishare said...

LOL :P

Coma said...

This is an elegant older post solution, but I have to ask why it refreshes every few seconds on your page and not on mine?

NathanKP said...

Sorry Coma,

I haven't added instructions on how to create the refreshing post link. I actually created it as an experiment after the fact, and it is actually fairly complicated depending on your blog's theme. Adding the refreshing code to this post is on my list of things to do, but I haven't yet gotten to it.

I'll have to unravel it out of my current code, which drives not only pagination, but also related posts, and random post links.

If you subscribe to the comments on this post, I'll comment when I get it done, and then you'll receive notification and be able to get the updated code with refreshing links.

Do you know ? said...

nice info... thx

NathanKP said...

I hope that it works for you. Once again, let me know if you experience problems with the random post link script.

Indra jaya said...

tanks

Anonymous said...

Hi Nathan,

I was looking for something which randomizes post order. None of my posts are connected so to say and they make for independent reading. So I was looking for something which randomizes the post order everytime the blog is rendered. So hit f5 and you see a different post first. Do you think its possible with Blogger? I'd really like that to work.

Cheers,
Vinod

ASHOK said...

Thanks Man!.

By,
Free Hacking Tricks

Anonymous said...

Remarkable! Its really awesome piece of writing, I have got much
clear idea regarding from this post.

My webpage ... naturalcleanseblog.com

Anonymous said...

Hi, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam comments?
If so how do you protect against it, any plugin or anything you
can advise? I get so much lately it's driving me mad so any help is very much appreciated.

Visit my weblog: trimextrindiet.com

Anonymous said...

I do not even know how I stopped up here, however I assumed this post was once good.
I do not understand who you're however definitely you're going to a famous blogger if you are not already.
Cheers!

Also visit my web page; Buy revolyn

Anonymous said...

When someone writes an paragraph he/she keeps the thought of
a user in his/her brain that how a user can know it.
Thus that's why this post is perfect. Thanks!

Also visit my web blog; home jobs online

Anonymous said...

It's truly very difficult in this full of activity life to listen news on TV, therefore I simply use the web for that reason, and take the latest information.

Have a look at my website; http://kids24.ch/zeige/594462893045606_1368714798.html

Anonymous said...

Hi there, I found your web site by way of Google whilst looking for
a comparable subject, your web site got here up, it seems to be good.

I've bookmarked it in my google bookmarks.
Hi there, simply become alert to your weblog thru Google, and found that it is truly informative. I am gonna be careful for brussels. I will appreciate should you continue this in future. Numerous other people shall be benefited from your writing. Cheers!

my web-site Buy no2 maximus

Anonymous said...

Hello, Neat post. There's an issue along with your site in internet explorer, could check this? IE nonetheless is the market leader and a large section of folks will miss your wonderful writing due to this problem.

Also visit my blog post :: payday Loans

Anonymous said...

I believe everything posted made a great deal of sense.
But, what about this? suppose you wrote a catchier title?
I ain't saying your content is not good, however what if you added a post title that grabbed people's attention?
I mean "Improved Random Post Link Widget for Blogger" is a little plain.
You ought to glance at Yahoo's front page and note how they create news headlines to grab people to open the links. You might try adding a video or a pic or two to grab people interested about what you've got to say.
In my opinion, it would make your blog a little bit more interesting.


Check out my homepage - Test-o-boost reviews

Anonymous said...

Hi, Neat post. There is an issue with your site in internet explorer, could test
this? IE nonetheless is the marketplace leader and a big element of people will pass over your fantastic writing due to this
problem.

Here is my blog: Pur Essence Skin Care

Anonymous said...

My coder is trying to convince me to move to .net from PHP.
I have always disliked the idea because of the costs. But he's tryiong none the less. I've been
using Movable-type on a number of websites for about a year and am
concerned about switching to another platform. I have heard great
things about blogengine.net. Is there a way I can transfer all my wordpress posts into it?
Any kind of help would be greatly appreciated!


Visit my homepage; Power Ecig

Anonymous said...

Great info. Lucky me I recently found your website by chance (stumbleupon).
I've saved it for later!

Here is my blog - raspberry ketone reviews

Anonymous said...

Hi there! I realize this is kind of off-topic however
I had to ask. Does operating a well-established website like yours require a massive amount work?

I'm brand new to writing a blog however I do write in my diary on a daily basis. I'd like to start a blog so I will be
able to share my own experience and feelings online. Please let me know
if you have any kind of suggestions or tips for new aspiring bloggers.
Thankyou!

Also visit my web blog - http://saffronxblog.com

Anonymous said...

It's very easy to find out any matter on web as compared to books, as I found this piece of writing at this website.

my web site ... http://adornablog.com

Anonymous said...

Ridiculous story there. What occurred after? Good luck!


Feel free to visit my web page; click through the next internet site

Anonymous said...

This is a topic which is close to my heart... Cheers! Exactly where are your contact details though?



my web site :: last longer durning sex