22

I need to create no follow links with link_to.

I'm looking for something like this:

<%= link_to "example", example_path, :target => "_blank" %>

But for no follow of course.

Abram
  • 39,950
  • 26
  • 134
  • 184
thenengah
  • 42,557
  • 33
  • 113
  • 157

1 Answers1

44

You can specify other attribues with link_to:

<%= link_to "example", example_path, rel: 'nofollow' %>

Produces:

<a rel="nofollow" href="example_path">example</a>
Abram
  • 39,950
  • 26
  • 134
  • 184
jdeseno
  • 7,753
  • 1
  • 36
  • 34
  • NB that if you are passing in arguments then you may need something like extra braces: `<%= link_to 'example', {:controller => :controller_name, :action => :ask, :param1 => "setting"}, :rel => 'nofollow' %>` – rogerdpack Jan 17 '14 at 10:03