【问题标题】:Rails rel nofollow linkRails rel nofollow 链接
【发布时间】:2011-03-23 12:29:50
【问题描述】:

我不需要使用link_to 创建关注链接。

我正在寻找这样的东西:

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

但是当然没有追随。

【问题讨论】:

    标签: ruby-on-rails nofollow


    【解决方案1】:

    您可以使用 link_to 指定其他属性:

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

    生产:

    <a rel="nofollow" href="example_path">example</a>
    

    【讨论】:

    • 注意,如果你传入参数,那么你可能需要额外的大括号:&lt;%= link_to 'example', {:controller =&gt; :controller_name, :action =&gt; :ask, :param1 =&gt; "setting"}, :rel =&gt; 'nofollow' %&gt;
    猜你喜欢
    • 1970-01-01
    • 2013-10-29
    • 2011-06-29
    • 1970-01-01
    • 2011-08-04
    • 1970-01-01
    • 2019-02-15
    • 1970-01-01
    相关资源
    最近更新 更多