Adding a Retweet Button to Single Posts

Continuing the theme of selectively showing widgets and stuff, I added a retweet button on single posts only. The button appears just below the post title.

If you have one or several full posts on your homepage then you want a retweet icon for each one! But if you use the readmore excepts then you don’t want 7 or 8 buttons on the homepage. Besides, who would tweet before reading the entire post?

It’s super easy to do, especially if you use this excellent post at BloggerPlugins.org. I don’t believe in reinventing the wheel (or copying it either). Aneesh gives you code for positioning the button on the top left or right using a full icon like below or a compacted one (takes up one thin line).I opted for the left side since many of my images are aligned on the right.

If you want the button on your homepage then just follow Aneesh’s tutorial and you’re done! Otherwise, go there to select your code, add your Twitter account’s url, post the code in your template. Don’t forget to leave a comment on his post! Preview your template and you’ll see the icon on your excerpts — but not for long! While the template is open, follow the steps below. Basically you’re adding conditional tags that limit the button to single pages only:

Step1:  Place the code in green just before the div line in Aneesh’s code:

<b:if cond=’data:blog.pageType == “item”‘>
<div style=’float:left;padding:4px;’>

Step 2: Place the code in green just after the end div line:

</div>

</b:if>

Preview (now you will NOT see the buttons on the homepage), Save the template and Open a single page. Finished!

If you found this post useful, leave a comment to let me know. Grab the BPWebnews tips button and share the luv with others. Get future posts in your RSS feed or by email.


If you found this post useful, leave a comment and share your thoughts with others.
Get future posts in your RSS feed or by email.


7 Comments

  1. This is what I see and it does contain your article's title and the tinyurl is clickable — takes reader to your blog fromTwitter. If yours is different send me a copy…

    RT @tweetmeme Survey Software and Market Research Tips and Information – Mineful.com http://tinyurl.com/yepukck

  2. Same to you Belinda — you can submit comments as 'name/url' instead of Blogger profile which provides very little info — or too many clicks to find the blog! You may want to consider putting a translation widget on your new blog as it develops.

  3. Thank you for this tip! I use the "read more after the jump" because of my narrow post body and lengthy reviews, so this was perfect. However, I like everyone else have yet to find the correct meta tags for the tweetmeme button so that when retweeted it displays the actual title of the post being tweeted and not the blog title. I figured it out for the Facebook share button, though it only shares the picture and the title, not a portion of the actual post, rather my meta information about the site. Better than nothing, I suppose.

    I think it would be a real coupe if you or someone could write a post about the meta tag info required for these share buttons to work properly. Sadly, no one has done that. Just a thought.

  4. Keith, I don't quite understand the problem. when I click the custom 'tweet this button' I get a short url to this post "http://bit.ly/5BaYtU Reading: Adding a Retweet Button to Single Posts"
    When I use the Tweetme button I also get a shorten url that points correclty to the post:
    "BP Web News and Tips: Adding a Retweet Button to Single Posts http://bit.ly/762j0k&quot;
    You have a chance to delet the blog name before you sent the retweet. So I don't know which button you have a problem with (facebook is not part of what this post is about??)

Comments are closed.