This is a quick tutorial on how to create a link that opens a new window/tab with a pre-written tweet. This is something you might find on a blog post, with a pre-written tweet you can easily share on your twitter feed. After reading this tutorial you’ll be able to create your own custom link with a custom tweet.
For this tutorial I’m going to show you how to do this using a blog post about Demand Generation from popular startup blogger Tom Tunguz as an example.
The link might look like this: Share this post
Here’s the code for the link. I’m going to use a basic text hyperlink, but you could use a linked image or button for your tweet link.
which looks like this:
It’s the link in that code that we’re going to work on. Let’s break it down:
First query (the url in the tweet):
Because you are putting a link within a link, you can’t just add the URL, otherwise it wouldn’t execute the URL in a browser. So there are symbols used to indicate certain characters in a URL. Here they are:
%3a = a colon
%2f = a forward slash
The URL Tom wants shared in the tweet is http://www.tomtunguz.com/importance-and-mystery-demand-generation
Second query (the text of the tweet):
Again, note that in a URL the %20 indicates a space. Also, Tom is adding his twitter handle in this tweet “@ttunguz” so he’ll be notified when someone shares his work.
Third query (related):
This is actually pretty cool. After you execute the tweet, this will show the twitter user “ttunguz” as a recommended account you should follow (if you don’t already). That is a neat customization that encourages those sharing your work to follow your account.
That’s it. Comment below if you have questions.