Short URL’s have become big business across the worldwide web, Google, Twitter and Digg for example all have their own, and you then have the big boys of short URL such as bit.ly and is.gd.
I recently wrote a Tutorial over on WPzine which covers making automatic short URLs in your posts for your readers to share. I then spoke to the brains of Nenuno (Daniel) and he mentioned su.pr urls.
Su.pr is a service run by Stumbleupon which shortens your URLs but can do so using your own domain too, the beauty of this service is your URL is syndicated to StumbleUpon, Facebook, and Twitter once you shorten the URL.
A side effect of this for example; here at Nenuno one of our links got over 1000 views as a result of the su.pr short URL, see below:
A graph showing how su.pr can help boost traffic
Quick Tutorial
So today I will show you a easy way to auto shorten your WordPress URLs using the su.pr API, you will be working in your functions.php and single.php file, please backup before making any changes!
Open functions.php and add:
[php]
function getsupr($url) {
$supr = file_get_contents("http://su.pr/api?url=".$url);
return $supr;
}
[/php]
This function utilizes the su.pr API and enables the short URLs to be created.
Now in your single.php add the following where you would like your su.pr short URL to be displayed:
[php]
<?php
$supr = getsupr(get_permalink($post->ID));
echo ‘here is a su.pr link: <a href="’.$supr.’">’.$supr.'</a>’
?>
[/php]
All done! Now each article on your blog will auto generate a su.pr short URL for you and your readers to share and also will benefit from the one click syndication that the su.pr service offers.
Using Su.pr To Boost Your Visitors
Ever since using Su.pr we have been treating it like another Twitter client and as a bonus its attracting a few extra visitors and this is how we do it.
Your first requirement is to have a Stumble Upon account, if not a quick registration is all it takes. Be sure to set it so when you submit a link it posts it straight to either your Twitter profile or Facebook Fan page.
I set to nenuno on Twitter and my fan page for nenuno instead of my personal Facebook account
Find the post you want to promote via su.pr and enter the URL in the Twitter like box.
Press “Just Shorten” which turns it into a short url which is shown in the tutorial above! Now style the post as you would on Twitter.
You can either schedule the post for another time or post it now. When posted, it will now be shown in your Facebook and Twitter timeline to all your followers and friends.
You will now be able to see how many times it gets clicked by your Stumble Upon friends. The flurry of visitors isn’t instant and can take time like any tools that promise increased traffic. But as an example, here are the statistics of a link we submitted yesterday.
** Note we are not promising a major traffic boost, we are simply sharing our experience with the service and hope it helps your project in some way!
Very useful Tutorial Really thanks
your more than welcome :)
Thanks for the tut. I guess they have a plugin for WordPress too.
This was really helpful! Thank you for all the great code sets.
Hi Paul! I have been LOVING this awesome feature, but it suddenly stopped working after I upgraded to WordPress 3.1 today. Is there anything I can do to get it up and running again? To see an example on my blog, scroll down to the bottom of the post in the “Share” section and click on the Twitter bird. It used to display the su.pr short URL in a Twitter status, but now I just get an error. Thank you so much for your help!!
I hear when you use a shortin url service like klien.biz it actually helps your SERPS within the engines!