Social Bookmarking Links

user-pic
Vote 0  

Filed:

 
I have not made up my mind yet, so far we have been using ShareThis for social bookmarking links, for submitting to sites such as Twitter, Delicious, Digg, etc. I think I would rather pick the few that are the most important and write them myself into the site.

I am going to start by doing that with Twitter. Thanks to a post on the MT.org forums, posts now have a quicker way to add links to Twitter. It uses the bit.ly API. You just need to signup for an account to get an API key. Hit the jump to see my modified code.

Another option is to use TweetMeme but their badge is pretty big, and I wanted something less obtrusive.
<script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&login=BITLY_LOGIN&apiKey=BITLY_API_KEY"></script>
<script type="text/javascript">
BitlyCB.shortenResponse = function(data) {
var s = '';
var first_result;
// Results are keyed by longUrl, so we need to grab the first one.
for (var r in data.results) {
first_result = data.results[r]; break;
}
// Now get the shortURL
shortURL = first_result["shortUrl"];
document.location = "http://www.twitter.com/home/?status=" + document.title.replace(/ /g,"+") + "+" + shortURL + "+(via+@bgviews)";
}
</script>
<img src="/path/to/image.gif" title="Tweet about <$MTEntryTitle encode_html="0">" onClick="BitlyClient.shorten(document.location, 'BitlyCB.shortenResponse');">

Email to a friend

Anonymous comments are always moderated, please sign in and join the discussion. Create an account for a user profile and community features. Please read our comments policy.

Leave a comment

About This Blog

Ken Edwards (and hopefully other project members) will be blogging here — a place to keep up on what is happening on the BG Views project. You will find bits of code, project updates, and random technical information aimed at confusing the hell out of you. More »

Subscriptions

Mobile Edition

Mobile EditionAccess the BG Views Developer Blog on your iPhone or other mobile device. Read more about our mobile site »
Powered by Movable Type 4.261

 

Also powered by:

  • Caffeine (Dr. Pepper)
  • Cup Cakes (Hostess)
  • Pizza (Pisanello's)