Make a “Share on Twitter” link with URL and Hashtags 

This is a little coding trick I get asked about quite a bit.

The link you have to make to share something to Twitter is quite simple:

http://twitter.com/share?text=text goes here

But getting a URL and hastag in there is a different matter. To be honest most developers do know how to include the URL, but hashtags have proved more elusive!

http://twitter.com/share?text=text goes here&url=http://url goes here&hashtags=hashtag1,hashtag2,hashtag3

Here’s an example to try out:

http://twitter.com/share?text=Here's an awesome tip!&url=http://petermahoney.net/make-a-share-on-twitter-link-with-url-and-hashtags/&hashtags=peter,is,awesome

And that’s it!