rel=”shortlink” Short URL Indicator and Its WordPress Support
As you know Short links are useful for microblogging, mobile applications as well as for applications where space or number of characters is a constraint. Many such famous services are available for shortening the URLs and are popularly known as URL shortening services. May be TinyURL is the most famous among them but also goo.gl from Google and t.co from Twitter, bit.ly etc are widely used.
But as you know many such services were short-lived and created ghost URLs where these shortened versions were not redirected to the actual URL as the URL shortening service become non functional. This is a major reason behind linkrot.
Linkrot is a phenomenon, were links on the web might become broken for several reasons. For example if the URL shortener becomes unreachable, the access to the final web resource will become impossible.
To overcome all these limitations rel=”shortlink” link attribute can be used to indicates that the hyperlink may be used for space constrained and/or manual entry. The author (Sam Johnston) released this work into the public domain and the rel=”shortlink” proposal solves the problem of linkrot.
By adding rel=”shortlink” to a link in a page indicates that the hyperlink may be used for space constrained and/or manual entry.
How to Use rel=”shortlink” in HTML pages and HTTP header
You can use the rel=”shortlink” attribute of link tag in the HEAD section of an HTML page. See the example below.
1 | <link rel="shortlink" href="http://yoursite.com/p123"> |
As part of HTTP header you can use s follows
1 | Link: <http://yoursite.com/p123>; rel=shortlink |
You can read the specification of shorlink
WordPress support for rel=”shortlink”
WordPress.com has its own URL shortening feature, wp.me. You can easily get shortlinks to your blog posts and pages using this service. You can see the “Get Shortlink button” next to the post/page Permalink when you create a new post or edit an existing post.
- “the_shortlink()” WordPress function can be used to display a “URL shortening” link for the current post.
- The function “wp_get_shortlink()” on the other hand outputs the complete shortlink for the post.
You can use “the_shortlink()” function as follows.
1 | <?php the_shortlink( $text, $title, $before, $after ); ?> |
were “text” is the link text to display, “title” is the tool-tip text displayed with the link and “before” and “after” are the HTML prefix and suffix added to the link.
Please note that by default, the short URL has a format of /?p=1234, and will only appear if pretty permalinks are enabled. See example below.
1 | <link rel='shortlink' href='http://www.globinch.com/?p=5288' /> |
The ” wp_get_shortlink()” is used to get short Link to a post for use in PHP. You can make use of this in your template PHP code.
The usage is as follows.
1 | <?php wp_get_shortlink($id, $context, allow_slugs); ?> |
were “id” is the post or blog id, “context” is used to determine the id and context
and “allow_slugs” is to decide whether to allow post slugs in the shortlink.
There are many wordpress plugins available to make this process automatic. For example the Short Link WordPress plugin adds a rel=”shortlink” link to each page as well as the corresponding HTTP header.
Join Globinch on Social Media
Follow Globinch
Popular Posts
- Turn your Windows 7 Computer Into a Personal Wi-Fi Hotspot 20 comment(s) | 26,793 view(s)
- Search Engines for File Sharing Sites : Rapidshare Search, Megaupload and More 2 comment(s) | 18,489 view(s)
- Google Translate Now supports Bengali, Gujarati, Kannada, Tamil and Telugu 2 comment(s) | 17,373 view(s)
- Best PDF OCR Tools to Convert Scanned images to Text / Word Documents 4 comment(s) | 13,748 view(s)
- Google Top Searches Today – Hot Google Search Words today 8 comment(s) | 13,529 view(s)
- Globinch Search 0 comment(s) | 10,427 view(s)
- Access Blocked sites, Unblock Restricted Websites 16 comment(s) | 9,473 view(s)
- Password Revealer – How To Reveal- Show Password Behind Asterisks? 1 comment(s) | 8,523 view(s)
- Play Angry Birds Game Free and Offline in Chrome Browser 1 comment(s) | 8,254 view(s)
- Free Online OCR Software to Convert Images Into Searchable PDF, Doc, HTML or Text 2 comment(s) | 8,092 view(s)
Recent Articles
- Samsung Galaxy Core Features, Specs, Price
- How to Use Wi-Fi the Secure Way
- 5 Apps to Boost Android Performance
- Building a Smarter Site Using a WordPress Platform
- Samsung Galaxy S IV Smartphone :Summary of All the Radical Innovations
- 5 Killer Tips to Increase Traffic to Your Blog
- Domain Parking to Make Genuine Money Online
- SEO Is Not Dead, But You Need to Upgrade The Process
- A Complete SEO Guide on Using Social Media for Better SERPs
- When Should You Use Geotargeting or Setting Geographic Target in Google Webmaster Tools?








