Template:bitly

  • Revision slug: Template:bitly
  • Revision title: Template:bitly
  • Revision id: 92478
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 1 words added

Revision Content

/* returns a short URL for the specified page */
if ($0) {
var key = "R_9a5688c38fa6773f347abf72a921a7df";
var user = "sheppy";
var page = wiki.getpage($0);
var url = web.uriencode(page.uri);
web.text("http://api.bitly.com/v3/shorten/?longUrl=" + url + "&format=txt&apiKey=" + key + "&login=" + user);
} else {
  web.text("Missing parameter: page path");
}

%>

Revision Source

<pre class="script">
/* returns a short URL for the specified page */
if ($0) {
var key = "R_9a5688c38fa6773f347abf72a921a7df";
var user = "sheppy";
var page = wiki.getpage($0);
var url = web.uriencode(page.uri);
web.text("http://api.bitly.com/v3/shorten/?longUrl=" + url + "&format=txt&apiKey=" + key + "&login=" + user);
} else {
  web.text("Missing parameter: page path");
}

%>
Revert to this revision