Over on our Payments News blog and here on SJL.US, I recently added the ability for the reader to “tweet this” post to Twitter. A friend asked this morning how I did that.
Here’s how. We’re running Payments News in what TypePad refers to as “Advanced Templates” mode – meaning that we can edit all of the various TypePad templates to do what we want.
One of the TypePad template modules – entry-individual – controls the display of individual blog posts. To add the “Tweet This” feature to every individual post in a TypePad blog, I added the following code to entry-individual:
The code shows the Tweet This graphic (you’ll need to host the image on your server and change the IMG URL to point to it) and builds a URL that when clicked opens the user’s Twitter home page with the URL of the blog post pre-inserted. The user simply clicks “update” on the Twitter page and the tweet is generated.
I’d really like to enhance this code so that the pre-inserted URL is pre-shortened – but I can’t figure out an easy way to do that. If you can help, please comment here! Remember, with TypePad I can’t do any fancy PHP-kinda stuff!