A bit of geekery for you today! I recently decided to overhaul my Social Media strategy. I created some workflows for myself and am currently sharing them one-by-one on my company blog – here’s the first one: Workflow for maintaining your social media presence: 1st of 3. But I also wanted to be able to offer quick ‘tweet this’ options for readers (and for my own use to tweet my own content). I got stuck adding links and hashtags so had to do a bit of Googling. To use this code you need to be able to write raw code, so if you use an editor find the raw code part. On WordPress it is the ‘Text’ tab at the top right of your writing box and it looks like this:
Find the part of your post that you want to insert the link and add the Tweet This Code…
The Tweet This Code
<strong>Tweet this:</strong> <a href="https://twitter.com/intent/tweet?url=http://bit.do/cN742&text=Tweet this! How to create a custom twitter tweet link with hashtags and link&via=kimdebling&hashtags=blogger,tweetthis" target="_blank">Tweet this! How to create a custom twitter tweet link with hashtags and link http://bit.do/cN742 #blogger #tweetthis via @kimdebling</a>
Why not go ahead and tweet that while you’re reading 😉
Complicated Yes..? Lets Break it down
The first part of the code creates the bold Tweet this text:
The rest of the code is encased in an ‘anchor’ tag – that’s the code that creates a link. It has an html section which is for the URL and a ‘target’ section which tells the computer to open the link in a new window or tab. Inside the two arrow sections is where the text that actually gets clicked goes.
<a href="....." target="_blank">.....</a>
So what is the URL to put in?
So let’s look at the composition of the URL. Usually, this will be a simple website address but we’re building something much more complicated. The first part is the website – that’s a specific address that twitter uses for pre-built tweets:
Next, we add the specific code that twitter has defined in order to add a link within the tweet – here I’ve used an URL shortener to make a super-short website pointer to this blog. http://bit.do/cN742 is many precious characters shorter than http://www.kimberlyann.co.uk/2016/10/24/twitter-tweet-this-with-links-and-hastags/ and might allow the tweeter to modify the text further while keeping the link. Having your link there means other people reading the tweet can click to see what it’s all about – no link means you’re not getting nearly as much potential coverage.
After the link goes the general tweet text.
&text=Tweet this! How to create a custom twitter tweet link with hashtags and link
Don’t forget to add your own @username tag – that way you’ll be notified when someone tweets it, since your username has been tagged. We do that by adding the username with the ‘via’ handle.
And finally add the hashtags, separated by a comma.
Add all those URL parts together and you get this:
https://twitter.com/intent/tweet?url=http://bit.do/cN742&text=Tweet this! How to create a custom twitter tweet link with hashtags and link&via=kimdebling&hashtags=blogger,tweetthis
What goes in between the code bits?
After you have inserted the URL into the correct part of the anchor tag, you need to fill in the text that the user actually sees. You can form that by writing out the following parts:
The text that makes up the tweet
i.e. Tweet this! How to create a custom twitter tweet link with hashtags and link http://bit.do/cN742 #blogger #tweetthis via @kimdebling
Insert that text just before the ‘closing tag’ for the link which looks like this: </a>.
I hope this was useful for you – get the hang of it and you can easily add a customised ‘tweet this’ link on your important blog posts and pages. Each tweet will have a link back to the place you want and will cause a notification (because of the @username tag) so that you can like the tweet, retweet and follow accordingly.
Kim Debling is a Hampshire, UK based designer and Director of her own company Kestrel Design Ltd. She is mum to Rose and Harvey and wife to her best friend Steve. She’s fighting off Stage 4 Lymphoma and sharing her story along the way, mainly via YouTube. Kim is passionate about being happy, mental wellbeing and in particular art and creative pursuits as therapy during tough times. She teaches online at Udemy, has published books and has art and printables available for sale.