如何添加相对=" nofollow的到我的ActionLink的? [英] How can I add rel="nofollow to my ActionLink?

查看:125
本文介绍了如何添加相对=" nofollow的到我的ActionLink的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下内容:

@Html.ActionLink("Register", "Register", "Users")

我想使链接包括以下内容:

I would like to make the link include the following:

title="Register your ID" 
rel="nofollow"

有没有一种方法,我可以MVC3做到这一点?

Is there a way that I can do this with MVC3?

推荐答案

只需使用的 ActionLink的 方式:

Simply use the proper overload of the ActionLink method:

@Html.ActionLink(
    "Register",                           // linkText
    "Register",                           // actionName
    "Users",                              // controllerName
    null,                                 // routeValues
    new {                                 // htmlAttributes
        title = "Register your ID", 
        rel = "nofollow" 
    }
)

应该产生(假设默认路由设置):

Should generate (assuming default routes setup):

<a href="/Users/Register" rel="nofollow" title="Register your ID">Register</a>

这篇关于如何添加相对=&QUOT; nofollow的到我的ActionLink的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆