Ads (728x90)

Latest Post

Kesehatan

Tips

googl logoMany of us are looking for automatic url shortener with Google's url shortener 'http://goo.gl'. When I was reading many articles and tutorials about url shortener I found a solution by Mr MS-Potilas. Using Google app engine he created a smart url shortener. As a base I am taking his code and app engine and presenting a url shortener which includes url short by http://goo.gl, http://mcaf.ee and http://cli.gs. MS-Potilas url shortener is little different and does not includes macfee and cligs url shortener. It is not very tough to use this feature/script with Blogger platform.

Default goo.gl url shortener interface on goo.gl home page


Google url shortener

goo.gl url shortener on your Blogger blogs with two other services


Custom goo.gl url shortener

Install automatic url shortener with http://goo.gl

1/. Blogger Dashboard › Select a blog › Switch to Template tab › Edit HTML › Expand widget templates
2/. Now search for <data:post.body>
3/. And now paste the following just below this or somewhere near 'post-footer-line-3' at right place.
Automatic url shortener with http://goo.gl
<script type='text/javascript'>
// Shorten Blogger post URLs using urltinyfy javascript API, by MS-potilas 2012
// Updated new shortener by Vinay Prajapati, Tech Prevue Labs 2013
//<![CDATA[
function loadscript(filename) {
var scr=document.createElement('script');
scr.setAttribute("type","text/javascript");
scr.setAttribute("src",filename);
document.getElementsByTagName("head")[0].appendChild(scr);
}
var waitElm=null;
function urltinyfyprompt_callback(response) {
if(waitElm) waitElm.style.display="none";
var txt="Short URL";
if(response.title && response.title!="") txt+=' for "'+response.title+'"';
else if(response.longurl && response.longurl!="") txt+=" for "+response.longurl;
if(response.tinyurl && response.tinyurl!="")
prompt(txt+":", response.tinyurl);
else
alert("Could not get short URL, try again later." + ((response.error && response.error != "") ? ("\nError: " + response.error) : ""));
}
function shortenUrl(elm, long_url, service) {
waitElm=elm.parentNode.nextSibling;
if(waitElm) waitElm.style.display="inline";
loadscript("http://urltinyfy.appspot.com/"+service+"?unify=1&url="+encodeURIComponent(long_url) + "&callback=urltinyfyprompt_callback");
}
//]]>
</script>
<span class='shorturls'>Short URLs:
<a expr:onclick='&quot;shortenUrl(this, &amp;#39;&quot; + data:post.url + &quot;&amp;#39;, &amp;#39;googl&amp;#39;);return false;&quot;' href='javascript:void(0)' title='Click to get short URL'>goo.gl</a>,
<a expr:onclick='&quot;shortenUrl(this, &amp;#39;&quot; + data:post.url + &quot;&amp;#39;, &amp;#39;mcafee&amp;#39;);return false;&quot;' href='javascript:void(0)' title='Click to get short URL'>mcaf.ee</a>,
<a expr:onclick='&quot;shortenUrl(this, &amp;#39;&quot; + data:post.url + &quot;&amp;#39;, &amp;#39;cligs&amp;#39;);return false;&quot;' href='javascript:void(0)' title='Click to get short URL'>cli.gs</a>
</span><span style='display:none;'><img border='0' src='data:image/gif;base64,R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gYGBgAAAC4uLoKCgmBgYLq6uiIiIkpKSoqKimRkZL6+viYmJgQEBE5OTubm5tjY2PT09Dg4ONzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCwAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7AAAAAAAAAAAA'/></span><div style='clear:both'/>
4/. Save the changes › Done.

How to generate goo.gl short url?

Just click on goo.gl or mcaf.ee or cli.gs to generate respective short url for Blogger posts.

Demo:

http://demo.techprevue.com/2013/02/professional-blogger-comment.html

Conclusion:

Url shortener is best thing to fight with spamming. It is short and sweet way to distribute long url over the internet especially on social media. Finally nice script is ready to create a short url from http://goo.gl that was most awaited by most of us.

Learn how to make changes in Blogger template

Post a Comment