Automatically add hashtags to your tweets

Hashtags are topics or categories for your tweets. They are in a way similar to (Blogger post) labels, but for Twitter. Hashtags are made up of keywords, preceded by a hash (#) symbol.

Adding a hashtag gives your tweet a potential to be picked up by people searching for that particular hashtag. Look at the example below as I hashtagged #blogspot and #tutorials to my tweet. If you were to search for either #blogspot or #tutorials using Twitter search box, then you just might see this particular tweet, together with other tweets with the same hashtags.

twitter hashtag

Now back to beginning of the post where I said hashtags are similar to labels. If that is the case, does it not make sense to use your labels as hashtags when you tweet your post? Yes, of course….but….okay I know you hate typing in those hashtags. (That is probably one of the reasons you put a retweet button in your blog in the first place).

That’s why we’ll make it automatic. With the help of Tweetmeme retweet button, all you have to do is click, I promise :). The button supports hashtags and coupled with some Blogger code, we can convert post labels to hashtags, automatically.

(If you haven’t added the retweet button already, follow the instructions in Add retweet button (with counter) to every post and add the button now).

 

I. Using labels as hashtags

Now how do we do that? Simple, just insert this code after line 3 of the existing Tweetmeme button code:

tweetmeme_hashtags = '<b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != &quot;true&quot;'/>,</b:loop>';

Note: A multiple-word label will be converted into multiple hashtags. For example a label “Blogger tutorials” will generate two hashtags -#Blogger and #tutorials.

 

II. Enter hashtags manually

To add the hashtags manually, use this code instead of the code in I.

tweetmeme_hashtags = 'myhashtag1,myhashtag2';

Each hashtag must be separated by a comma. The above code will add #myhashtag1 and #myhashtag2 to all your tweets.

 

Enjoy!

8 comments to "Automatically add hashtags to your tweets"

gxg May 20, 2010 at 9:12 PM    

Great! Worked like a charm! :)

Hack Tutors May 21, 2010 at 12:39 AM    

Why so it is needed?

shan,  May 21, 2010 at 7:09 AM    

Hi, Please, i need your help to setup my blog Header.

After designing all the layout with the help of my friend's now i have added Navbar, and all of post area has started moving downward.

Please Help me to Lock the area's to avoid such problems.

and how can i set the templete right down the navbar. thanks
www.realwebb.blogspot.com

Greenlava May 21, 2010 at 1:06 PM    

@gxg
Hey thanks for sharing this article on rssmeme :)

Greenlava May 22, 2010 at 11:37 AM    

@Hack Tutors
I've added a little explanation in second paragraph, hope that helps.

@shan
Sorry but I don't see any navbar installed.

ARC™ June 15, 2011 at 8:35 PM    

ummm dude, again, thanks for replying my every inquiries. Can this works for other button? Ive already have fb share, tweet this, and tweet follow buttons at the end of my every posts see here [a href="http://www.arcx13.com"]CLICK HERE[/a]

so, installing another button would be an ayesore (personal opinion, though)

back to my question, is that possible? hashtags for normal tweet button?

Greenlava June 17, 2011 at 12:51 AM    

@ARC™
This label-based hashtags trick only works with Tweetmeme button.

Ramkalyan December 16, 2012 at 10:55 PM    

I've learnt something completely new today. Never heard of hashtags until now. Thank you very much Greenlava!

We love to hear from you! Leave us a comment.

To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool. Then paste the escaped code here. For personalized help, you can HIRE ME.

Click to go to top Click to comment