In this Drupal development tutorial - I will explain how you can nofollow external links, but still dofollow internal links on your Drupal website. For a starter - let me explain the reasons when and why you should need such an option.

You might already heard of Google Panda's and Google Penguin's right?

Those two are algorithms fighting with low quality websites, such as thin affiliate sites. In quick words - to stay safe - you should avoid of copy/pasted or scrapped content and too many low quality (internal and external links).

For purpose of your On Site SEO - you should avoid of dofollow links to affiliate sites (and other advertisments - not to say to avoid link schemes e.t.c.)

Here is an example - I'm writing my blog - reviewing some products, places and of course I'm adding an external links to my blog posts. That's perfectly fine - and that's perfectly fine to leave them dofollow, expect  if you are adding too many links in one article - let's say by doing affiliate marketing. You may get penalized by using dofollow links to affiliate products.

Here is a video on that by Google's Matt Cutts:

 

Anyway - the purpose of this article is not to guess how many links should be fine on your site, but how to nofollow external links on your Drupal site.

By default Drupal is offering to use text format filters, and one of the options is to set all links to "nofollow"

When I first started - I decided to nofollow completely all links I have, but here is the reason why it's wrong - 

Main reason why it is wrongs is simple - you are not only nofollowing all external links, but you are nofollwing both all internal links.

Internal links are crucial for your on-site SEO.

So I started to investigate what options do I have - first option is to set nofollow links by hand, but this option is not for me - it might be time consuming. And since I already have a blog with plenty of posts, it would mean I should go through all the blog posts I have, and manual add nofollow attribute. 

Another option - I searched for - to use some custom Drupal module  - and for a luck I did find one - what does exactly what I need - Noindex External Links (this is a nofollow link)

This module seems have been built exclusively for Runet (Russian Internet space) for Yandex search engine optimization. But it does still offers option to add nofollow for external links.

All you have to do, is to download and install this module (this is a dofollow link) to your Drupal site and do some basic setup:

Head to admin/config/search/noindex_external_links and mark check next to Add atribute rel="nofollow" to links:

Settings for Noindex External Links Module

On the same settings page add your domain names, you would like to be dofollowed (for example your website or blog URL)

Noindex External Links Drupal Module's Settings

There is one more thing to configure, before it will actually start to work - go to your text format filters page, and mark check next to Noindex External links (admin/config/content/formats/<your-format>)

Drupal Text Format settings page

Basically that's it - now you have formatted your external links to be nofollow while your internal links stay dofollow.

Bonus 

You would like (and I recommend that you have it) to open any external link in a new tab - again you have a few options, but for a quick reference I will suggest to you use External links module.

 

Hope this article helped you to set your external links to nofollow. Feel free to drop a comment!