PureNews

PureNews is an amazingly sleek and powerful news theme with unlimited color variations.

View full feature list Check out the live demo Buy this theme today

How To Remove The Digg Bar From Your Blog Using PHP

Posted by on 13th Apr 2009 Design & Coding 0 comments

Last week I showed how you can remove the digg bar from your blog using javascript. Jonathan Bailey also wrote about this subject and he later emailed me about an article John Gruber wrote.

As some of you may know, Javscript has some limitations. One of the biggest problems is that users have the option of switching javascript off. Thankfully, John has posted a PHP solution to removing the Digg Bar.

By placing this code in your header template you can give a customised message to Digg Users. You can see an example of this on Johns site here.


<?php
if (preg_match('#http://digg.com/\w{1,8}/*(\?.*)?$#',
                            $_SERVER['HTTP_REFERER']) ) {
    echo "<p>Special message for Digg users here.</p>";
    exit;
}
?>

Which code to use?

The PHP solution above will post a message to all Digg users so in that regards, it is the best solution to use. The Javascript solution I posted last week has some limitations, the main one being that some users turn Javascript off. However, using the simple Javascript solution breaks frames from all websites whereas the PHP solution posted above only removes the Digg Bar.

Therefore, the decision is really up to you i.e. do you want to remove all frames or do you just want to tell Digg Users they can’t view your blog using a frame?

I’d also like to give the following a mention :

  • DiggBar Killer – A Firefox plugin which lets non Digg users (and those not signed in) kill the Digg Bar (note : signed in members can turn it off in their profile).
  • No Frames WordPress Plugin – I personally think the Javascript solution is much easier to add but if you use WordPress, you may prefer to break frames by installing this plugin.

The Digg Bar is Bad For SEO

When I first read about the new Digg Bar I was annoyed because Digg would be denying PageRank Juice to thousands of bloggers. I was then informed that PR juice was still passed on because Digg add a rel=”canonical” tag to all outgoing links.

The rel=”canonical” tag is supposed to pass all PR Juice to the designated page. However, according to seOverflow, Digg is misleading users :

The problem with this is that the canonical tag only works on pages of the domain it’s on. Since Digg is not your website, this canonical tag is doing nothing.

I wasn’t 100% sure if this was true so I checked online and confirmed that it is the case (the announcement of the tag was made in February when I was travelling). Apparently, the tags main use is to help those with the same content on the one site. For example, if you own a shopping site you may have one product listed in 3 or 4 different categories. This tag allows you to tell Google that all the juice should be going to one page.

As previously mentioned, the canonical only works within the same domain so why are Digg using it?

For more information on the canonical tag, please check out randfish’s article entitled ‘Canonical URL Tag – The Most Important Advancement in SEO Practices Since Sitemaps‘.

Related Link : How to remove the Digg Bar using PHP

Kevin Muldoon is a webmaster and blogger who lives in Central Scotland. His current project is WordPress Mods; a blog which focuses on WordPress Themes, Plugins, Tutorials, News and Modifications and useful resources such as 101 Places To Find Images For Your Blog Posts.

0 comments - Leave a reply

Comments are closed.