Pro Tip: How to Make a Random Posts Link in Your Blog or Website
One of the reasons why I like the idea of having a random posts link is because it allows visitors opportunities to discover posts that they might not necessarily find because they’re not on the front page.
I also think it’s pretty cool to be able to click a link and see where I end up. I’ve always wanted to make one of my own, but I didn’t know how until recently.
Now that I know however, I’d like to share that information here just in case you also have a blog and have been wanting to know how to do it yourself.
Another reason why I like this option that I’m sharing is because you could use it without having to install a plugin to get the job done, making this option accessible to bloggers whether their websites are self-hosted or not.
How to make a random posts link in your blog or website
To create a url for random posts on your blog, just type in:
where “yourwebsiteaddress.com” is your actual web address.
So for me, my random posts url would be:
http://relandothompkins.com/?random. Using that formula, what would yours be?
To hyperlink it into some text, use:
<a href="http://yourwebsiteaddress.com/?random">insert whatever descriptive text you want here</a>
To create a button, you can upload whatever picture you want to use for the button, get the url for that picture, and put that url into this code. The descriptive text in this particular code is “click for random post”, but you can change that and call it whatever you want:
<img src="URL_of_button" alt="click for random post" title="random button" />
If you’d like to place a random post link into your sidebar, you can also use these same codes, entering the information specific to your site into a text widget.
If you’re embedding the link within an individual blog post, you can also highlight the text and hyperlink it to your random posts url.
You can display the actual link itself: http://relandothompkins.com/?random
or you can write descriptive text, highlight it, and place the link within that text
with the result being:
Check out this link to learn more.
Now when visitors click on the text that you’ve highlighted and selected, they will be taken to wherever you made the link to, which in this case would be a random post.
Note: When doing this, you can decide whether or not you want the link to lead to a new tab by selecting the box that appears after you hit the link button.
For the sake of this particular post, I have my links starting in a new tab to give you an idea of how it works, but for my own purposes I generally have this type of link open in the same window.
Introducing (N.A.H) Shuffle
I’ve now placed my own random posts links in my sidebar. One is contained in a link below my site logo and social media handles near the top of my sidebar.
I’ve attached the other to a button in the form of a shuffle symbol just below my most visited posts for the day:
You can click either of these links: the (N.A.H.) Shuffle text near the top , or the shuffle symbol under the day’s most visited notes in my sidebar anytime to be taken to a random note.
If you’re interested, try this out on your own blog or website.
From Aspiring Humanitarian, Relando Thompkins, MSW