CREATE CUSTOM PERMALINKS FOR ALL BLOGGER POSTS.

 On Senin, 02 Juli 2012  

You might have noticed some blogs having shortened urls at the top/bottom of every post with a “Share this post” text. This is a very nice widget which can help increase your blog's traffic as visitors won't have to go through the stress of manually getting your posts url.

How to add shortened url to your blog.

In this tutorial,I 'll be making use of bit.ly i.e twitter's default service. bitly.jpgTo begin,you will have to create an account with bit.ly to get your API KEY.Once gotten,we can begin with the tut.

STEP BY STEP TUTORIAL.

Login toBlogger&go to Design/Layout » Edit HTML.[Always remember to backup your template.]Check the box next to Expand Widget Template and search for </head> by pressing CTRL+F.On getting that,Copy-Paste the code below directlyabove/before

<script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&amp;login=USERNAME&amp;apiKey=YOURAPIKEY"></script> <script type="text/javascript" charset="utf-8"> BitlyClient.addPageLoadEvent(function(){ BitlyCB.myShortenCallback = function(data) { // this is how to get a result of shortening a single url var result; for (var r in data.results) { result = data.results[r]; result['longUrl'] = r; break; } document.getElementById("shorturl").innerHTML = "Share this link: &lt;input type='text'value='" + result['shortUrl']+ "' name='bitlyurl'/&gt;"; } BitlyClient.shorten(document.location, 'BitlyCB.myShortenCallback'); }); </script>

Replace USERNAME with the name you supplied while registering at bit.ly and also replace YOURAPIKEY with the key assigned to your account.

STEP 2»

Search for this line of code[CTRL+F]

<div class='post-footer-linepost-footer-line-3'>PLACE SCRIPT HERE</div>

Replace “PLACE SCRIPT HERE” in the code above with this»»

<b:if cond='data:blog.pageType =="item"'><form id='shorturl'/></b:if>

Now,Preview & Save your template.

You should now have a shortened url in all your blog posts. If you encountered any problem trying this,don't hesitate to leave a commen behind.

CREATE CUSTOM PERMALINKS FOR ALL BLOGGER POSTS. 4.5 5 Unknown Senin, 02 Juli 2012 You might have noticed some blogs having shortened urls at the top/bottom of every post with a “Share this post” text. This is a very nice ...


Tidak ada komentar:

Posting Komentar