I configured the Text Format "Plain text" (admin/config/content/formats) to "Convert URLs into links" so I would like to add the attribute rel="nofollow" to all the links in the comments.

This way I would minimize the effects of spammy links in the comments.

Is there an easier way than using regular expressions to insert the attribute?

4 Answers 4


Go to Configuration -> Content authoring -> Text formats -> Plain text (your format), then tick the Limit allowed HTML tags option.

In the filter settings at the bottom of the page is the Add rel="nofollow" to all links checkbox. Tick that... Since this is plain text, you will probably want to remove the contents of the Allowed HTML Tags field, too.

  • Oh my... that was easy. I should have seen that.
    – FR6
    Commented Dec 23, 2011 at 18:24
  • It's not in the most intuitive of places, I must say... Commented Dec 23, 2011 at 18:26
  • very cool! I wasted about half an hour too looking at extlink and links_nofollow modules ;-)
    – uwe
    Commented Dec 23, 2011 at 23:28
  • 1
    It does not work but this one does: befused.com/drupal/nofollow . Unfortunately it adds nofollow to internal links too. Here is alternate way: thecarneyeffect.co.uk/… . Here is more about using nofollow with internal links: searchengineland.com/…
    – AgA
    Commented Dec 18, 2013 at 10:00

Jim is mostly Right (but it matters what order the filters are in and you would need to add the <a> at least to that filter). A slightly better way (in that it lets users still put in just the URL or protects you if they try to all a rel=follow to their a tag) would be:

  1. Go to admin/config/content/formats/plain_text
  2. Check only Limit allowed HTML tags, Convert line breaks..., and Convert URLs into links.
  3. Make sure your filter is ordered starting with Convert URLs into links, then Limit allowed HTML tags, then Convert line breaks into HTML...
  4. Under Limit allowed HTML Tags filter settings, change allowed HTML to just <a> and make sure the Add rel="no-follow" to all links is checked. I like to unchecked the Display basic HTML help in long filter tips here.

noindex_external_links is a nice module to add rel=nofollow to external sites. We can dofollow selected sites and it does not add nofollow to internal links.

To make it work I placed the filters in this order(for plain text format): Display any HTML as plain text -> Content URL's into links -> Noindex external links filter


You can also use - https://www.drupal.org/project/ckeditor_nofollow module, which provide an widget, which can be used to add rel="nofollow".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.