January 18, 2009 by Vincent
WordPress Ugly Permalink as Short URL for Twitter-ing
Martin Wright made a good point in his guest post on TwiTip about using our own blog domain to host short URLs pointing to your blog posts, instead of services like TinyURL, Bit.ly and tr.im.
Martin suggested the use of Short URL WordPress Plugin to do the job, but I see a better way to do it.
Back to the basic, what was the permalink structure when you first installed WordPress? The ugly permalink structure that looks like this:
http://www.sheeptech.com/?p=123 (123 is the Post-ID)
Most WordPress users would change their permalink structure to a more SEO friendly ones, instead of keeping the ugly permalink structure above.
However, an ugly permalink will not stop working even after the permalink structure is changed. Instead, it will automatically redirect you to the actual blog post with the correct permalink. For example:
http://www.sheeptech.com/?p=881 will redirect to
Say I would like to share my blog post on YouTube Muting Videos on Twitter, I’d post it as (http://www.sheeptech.com/?p=881), instead of the full permalink of it or a third party short URL like http://tr.im/8y5j.
How to identify Post-ID?
The ugly permalink structure looks like this: http://www.sheeptech.com/?p=[Post-ID]. You first have to identify the Post-ID of your blog post, before you can use the ugly permalink as a short URL.
To identify the Post-ID of your blog post, just look at the address bar when you are editing or writing a post. The Post-ID would be the number next to “post=“.
- No extra work. The ugly permalink is generated automatically everytime you publish a blog post. No need of a plugin at all.
- The URL will not be broken. Even when you change your permalink struture again, the ugly permalink will still point to the same blog post. If you’re using a plugin to shorten URLs, they might be broken if the plugin went wrong, but the ugly permalink will almost never be broken.
- You can call up the Post ID within your blog template using the
<?php the_ID(); ?>tag.
As there is no extra work for this method, I can conveniently add a Twitter button onto all my blog post. This is the line I inserted to
<a rel="nofollow" href="http://twitter.com/home?status=Reading: (<?php the_title(); ?>) at http://sheeptech.com/?p=<?php the_ID(); ?>"><img src="http://www.sheeptech.com/wp-content/uploads/2009/01/twiter_01-w32-h32.png" alt="Tweet This" /></a>
Click on the blue bird at the end of this post for a demo.