Nofollow that becomes Dofollow in your website's comments?!!

Published on
Aug 14, 2010

Sometimes, more than often, you won't allow nofollow links in your comments. And sometimes, less than often, there will be those smart people, or just merely utilizers, who will overcome this barrier pretty easily.

The situation becomes even more confusing when you discover that these comments on your website don't have nofollow links, but in your database these same comment do have them! Pretty weird huh?

The answer is simple: your sanitize() function - that same doctor, who cleans the unwanted tags and attributes, becomes your enemy and cleans the rel='nofollow', and what is left is of course fully legitimate SEO optimized links to the unwanted :)

The solution for Ruby On Rails is damn easy - add this line to your environment.rb:
Rails::Initializer.run do |config| config.action_view.sanitized_allowed_attributes = 'rel' # <- this line :) #... end

No matter what language you use, it should be similarly simple to change this behavior once you understand the problem.

So good luck, and n-joy!