How To Apply rel="nofollow" To Content In Drupal
If you’ve got a community website using Drupal, you might want to protect your site from spammers by applying the rel=”nofollow” attribute to any links your users generate.
The theory behind this is that you protect your site from linking to ‘bad neighbourhoods’ an possibly incurring penalties with Google for spammy links. Rel=”nofollow” is your way of saying – as the site owner – that you can’t vouch for the quality of those links.
Anyway, you probably already know the reasoning – let’s show you how to set this up.
Configuring Nofollow On Input Filters
Yes, that’s right. The “nofollow” attribute is configured on Input filters. Go to your Drupal administration pages and browse to Site Configuration -> Input Formats.
Normally you want the default Input Format set to Filtered HTML for user-generated content. This allows your users the ability to use HTML formatting without having access to insert scripts or other disruptive things on the site.
- Click on the configure button for Filtered HTML. You’ll see under the Filters heading that a number of filters are activated. If the HTML Filter isn’t activated, then activate it and save your changes.
- Click the Configure button at the top of the page and you’ll see how the filter is currently configured.
- Activate the option for Spam link deterrent and save the settings. All outgoing links will now have rel=”nofollow” applied to them.
Refining With Access Permissions
If you want to be especially clever about it, you could modify permissions so that regular members and anonymous users get the Filtered HTML input by default but set your ‘trusted members‘ up with access to a less restrictive Input Format such as Full HTML.
But that’s a conversation for another day, folks…