Mark Meta widget with “nofollow”

Due SEO considerations it is not recommended (e.g. by Matt Cutts) to spend precious page rank on links like log-in, register formulars, rss pages and other meta stuff. One thould mark them as nofollow and that is one example where nofollow attribute can be turned in something useful.holbreich_meta.jpg

Nearly every Worpdress blog would have something like Meta section in the sidebar, every link there should be marked as nofollow. Unfortunately there are not coded in one widget, they are distributed over two files in the standard wordpress installation.

Yo need also update two files:

  1. /wp-includes/widges.php
  2. /wp-includes/general-template.php

In the widgets.php you need to ad rel=nofollow inside of the function wp_widget_meta(), so that result of this looks like this:

function wp_widget_meta($args) {
extract($args);
$options = get_option(‘widget_meta’);
$title = empty($options['title']) ? __(‘Meta’) : $options['title'];
?>
<?php echo $before_widget; ?>
<?php echo $before_title . $title . $after_title; ?>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href=”<?php bloginfo(‘rss2_url’); ?>” rel=”nofollow” title=”<?php echo attribute_escape(__(‘Syndicate this site using RSS 2.0′)); ?>”><?php _e(‘Entries <abbr title=”Really Simple Syndication”>RSS</abbr>’); ?></a></li>
<li><a href=”<?php bloginfo(‘comments_rss2_url’); ?>” rel=”nofollow” title=”<?php echo attribute_escape(__(‘The latest comments to all posts in RSS’)); ?>”><?php _e(‘Comments <abbr title=”Really Simple Syndication”>RSS</abbr>’); ?></a></li>
<?php wp_meta(); ?>
</ul>
<?php echo $after_widget; ?>
<?php
}

As you see, wp_register() function is called here, and therefore we need to modify general-template.php file. Excatrly the mentioned method, so that it looks like this:

function wp_register( $before = ‘<li>’, $after = ‘</li>’ ) {

if ( ! is_user_logged_in() ) {
if ( get_option(‘users_can_register’) )
$link = $before . ‘<a href=”‘ . get_option(’siteurl’) . ‘/wp-login.php?action=register” rel=”nofollow”>’ . __(‘Register’) . ‘</a>’ . $after;
else
$link = ”;
} else {
$link = $before . ‘<a href=”‘ . get_option(’siteurl’) . ‘/wp-admin/” rel=”nofollow”>’ . __(‘Site Admin’) . ‘</a>’ . $after;
}

echo apply_filters(‘register’, $link);
}

Notice that I have added only nofollow relation and nothing more.

However that is not the best solution cause, when these files have been changed in new version you have to patch them all manually. unfortunately, there is no mechanism to preserve standard widgets to be not be updated as i think unless of creating own meta-widget plugin, but this is to much for this purpose. What do you think about?

Update: There is already a plugin for it. :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • BlinkList
  • MisterWong.DE
  • Slashdot
  • StumbleUpon
  • Technorati
  • NewsVine
  • Reddit
  • Yigg
  • HackerNews
  • LinkedIn
  • Webnews.de
  • Yahoo! Buzz

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

In fact that’s much easier to block /wp-* in robots.txt to prevent crawlers from following meta-links.

Yes something like
User-agent: *
Disallow: /wp-login.php

in robots.txt is much easier indeed .
But has it really same effect? I’m unsure. So robots.txt will prevent that pages from crawling. But will it affect the PageRank distribution too? Better is using both.

Thank you, in any case, for this hint!

In my opinion the effect should be the same: no pages crawled => no pages indexed => no pages have assigned PR. At least it seems logical, but who knows the real algorithm of PageRank distribution?

The only real prove of incorrectness of this opinion could be the page with positive PR, but which never was out of robots.txt block.I’ve never seen such a page yet, even with SeoQuake bar constantly turned on while surfing.

“… but who knows the real algorithm of PageRank distribution?” I tell you the same. ;) I can understand your considerations, but the point is we don’t really know how it actually works, we can only assume and believe.

The fact (or believe) that disallowed link has no pagerank is no guaranty for that the outgoing pagerank to other sites of the homepage was not declined by the not marked link.

However there is nothing bad in doing it twice (nofollow and robots.txt) would you agree? :)

In addition well known SEO Guru Matt Cutts point’s us to do this. Does he know about robots.txt??? ;)

Leave a comment

(required)

(required)