Drupal SEO - Nofollow Links
Image
I have been updating this site recently and ran into a few issues with Google indexing tag taxonomy pages and following tag links which had less than desirable results for my SEO efforts. In general, taxonomy pages such as tag archives should have a noindex meta tag as these types of pages often contain duplicate content.
To further fix the issue, I created a simple theme function that adds the rel=nofollow attribute to the links within the tag taxonomy. This means that Google shouldn't follow links to tag archives which in turn should provide a nice boost to other links on my site.
/**
* Add nofollow attribute to any link within the taxonomy vocabulary_1
*/
function yourtheme_preprocess_link(&$vars) {
if ($vars['options']['entity']->vocabulary_machine_name == 'vocabulary_1') {
$vars['options']['attributes']['rel'] = 'nofollow';
}
}