[英]rel attribute in <a> in Rails 3 erb file
我想知道在<%= link_to_peramlink%>中有任何rel属性,就像html中的tag一样。
例如:在html我的链接
我在rails中有<%= link_to_permalink文章,“con”,nil,“my link”,“5m”%>。 那里有任何rel属性吗?
link_to_permalink
不是标准的Rails助手。 一个简单的:
<%= link_to article.title, article %>
(您可能必须调整article.title
)将让你的文章链接,假设是这样resources :articles
中定义routes.rb
。
设置rel
属性很简单:
<%= link_to article.title, article, :rel => 'nofollow' %>
或其他属性:
<%= link_to article.title, article, :rel => 'nofollow', :class => 'my-css-class' %>
最后,我不知道你的link_to_permalink
助手做了什么,但你可以使用to_param
来制作seo友好的永久链接: 见这里 。 (如果您知道我的意思,这就是“铁路方式”。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.