It’s really very simple, but this one took me a while to figure out, so I thought I’d post it in case it helps someone else.
If you want to add a rel='nofollow' attribute to a link generated with a Rails helper, you just need to specify it in the html_options hash argument to link_to (or whatever link helper you’re using).
For example:
<%= link_to 'Vote', { :action => 'vote' }, { :rel => 'nofollow' } %>
Voila! This should discourage web crawlers (such as the Google search crawler) from following links they shouldn’t and generating false ‘clicks’.
Leave a Reply