social networking

Adding Tweetmeme to your Drupal site Dec 15 '09

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.

Display your facebook status on a Drupal site Nov 8 '07

So things are getting out of hand with all the crazy web 2.0/social networking sites popping up but if you've got a facebook account chances are you haven't tired of the ability to post your status whenever you want.

Something I noticed recently is that your facebook status is published as an RSS feed from your profile (go to your profile, then click on 'see all' in your mini-feed, then filter to 'status stories.').

What this means is that you can grab that feed and display it on your Drupal website using the feed aggregator module!  Nice!! :)  read more »

Syndicate content