There are so many reasons to making your site easily visible on Social Networking websites and platforms - they raise general visibility and offer access to communities which may not otherwise find the information you spend time publishing in your posts.
Of course, one of the most agile word-of-mouth Social platforms on the web is Twitter and you may have recently noticed a pretty cool widgety thing people are using on their blogs/sites to include a 'retweet' link and counter of how many times a post has been tweeted - its powered by a site called 'Tweetmeme' and installs pretty easily on any website - whether using static html or a CMS like Drupal.
When you take a peek at the tweetmeme page containing the necessary embed code it may not be too easy to tell how to use it with your Drupal site - and though there's a module out there for Tweetmeme, it may not offer the flexibility you require for clean theming. Fear not, there's an easy way to go about embedding this and all it takes is a small modification of the de facto embed code.
All you have to do is:
- copy the following code,
- replace 'http://mysite.com' with your own root URL and:
- replace 'twitterhandle' with your twitter handle (if you want reweets to automagically incude @yourtwitterhandle - you can opt to delete that line from the code otherwise.
<script type="text/javascript"> tweetmeme_style = 'compact'; tweetmeme_url = 'http://mysite.com<?php print $node_url ?>'; tweetmeme_source = 'twitterhandle'; </script>
The trick then is to take this code and include it in the appropriate version of node.tpl.php for your theme - for example, if you only want the tweetmeme widget to be displayed in blog posts for a content type called 'blog' then bung it into whatever place you want in your node-blog.tpl.php file. You can learn more about versioning the node.tpl.php file for this purpose in the drupal.org theming guide.
Basically what we've done here is include some php to tell the embed code the specific URL for each post - without this php it will only work on full-node view pages and not Views/Panels that list multiple nodes.
*You can see the widget in action here on this site below - just to the right of the tags for each post.
Related Post(s)
-
Thursday Dec 22, '11
-
Wednesday Dec 14, '11
-
Thursday Sep 15, '11
Recently blogged
Recent comments
-
Every New Year bringsSaturday Jan 28
-
A new product if is goodFriday Jan 6
-
Great post however I wasSunday Dec 25
-
a new indexhibit is coming!Wednesday Nov 30
-
I love this site you made. SoWednesday Sep 14
Our Podcast
Subscribe to our podcasts through the iTunes store for free!
Subscribe
Sign up to our email newsletter to stay in touch - we send it out monthly and never spam.
Archives
- October 2007 (5)
- November 2007 (6)
- December 2007 (1)
- January 2008 (1)
- February 2008 (1)
- March 2008 (2)
- April 2008 (6)
- May 2008 (1)
- June 2008 (1)
- July 2008 (2)
- August 2008 (1)
- September 2008 (5)
- October 2008 (3)
- November 2008 (1)
- January 2009 (3)
- February 2009 (1)
- March 2009 (4)
- April 2009 (2)
- May 2009 (1)
- November 2009 (3)
- December 2009 (2)
- January 2010 (13)
- February 2010 (5)
- March 2010 (9)
- April 2010 (2)
- June 2010 (9)
- July 2010 (6)
- August 2010 (3)
- September 2010 (4)
- October 2010 (1)
- November 2010 (2)
- January 2011 (2)
- February 2011 (3)
- March 2011 (3)
- April 2011 (3)
- May 2011 (3)
- June 2011 (2)
- July 2011 (1)
- August 2011 (3)
- September 2011 (2)
- October 2011 (1)
- November 2011 (2)
- December 2011 (3)
- January 2012 (1)