Tag Archives: shortlinks

Twitter and their “shortener”

tl;dr Composer just got better at posting tweets, so post full urls instead of shortening.

Twitter automatically parse out any domain name or url in a tweet and replaces it with a t.co link. If you type something like twitter.com your 11 character domain gets converted into (currently) a 22 character t.co link.

Until today, Composer wasn’t very good at understanding this. Sometimes, it would shorten your post before sending it to twitter when it wasn’t necessary. And worse, with the introduction of images, sometimes posts to twitter would fail. If you add an image, you lose (currently) 23 characters from your tweet because twitter posts a link to the image (22) plus a space (1).

So, from today, we’ve built custom handlers just for twitter. We parse out any domain or url, replace it with (currently) 23 characters, and then check if your tweet is <140.

Shortlinking

This means, if you post a massive url to twitter, it gets auto shortened on twitter’s side, and now Composer is smart enough to figure that out. So if you’re posting links to Facebook, Twitter and WordPress, post the full url, no need to use a shortener.

Two caveats, we’re a little conservative because twitter’s t.co links are 22 characters for http links and 23 for https links. So we assume all links are 23 just to be on the safe side. Also, we parse out all domains (like composer.io or github.io) which Twitter doesn’t. I filed a bug.

This was made substantially easier thanks to twitter-text-php, thanks to its authors.

Auto shortening for twitter, etc

More goodness from the composer HQ today! If you type a message over 140 characters and send it to Twitter, Plurk or Identica, we’ll automatically shorten it, post it on a URL, generate a short link, and then post the beginning of your message along with a short link to the full message. It’s live now, no configuration necessary.

Shoot over any feedback in a comment… 🙂