First of all, I decided to add “rel” to my link to the action for SEO reasons, but I’m not sure that the way I went about it will follow the “best practices”. I just created a new extension method as shown below.
Is this the best way to do this? Is there something that needs to be changed in this approach?
BROWSE
<%= Html.ActionLink("Home", "Index", "Home") .AddRel("me") .AddTitle("Russell Solberg") %>
EXPANSION METHODS
public static string AddRel(this string link, string rel) { var tempLink = link.Insert(link.IndexOf(">"), String.Format(" rel='{0}'", rel)); return tempLink; } public static string AddTitle(this string link, string title) { var tempLink = link.Insert(link.IndexOf(">"), String.Format(" title='{0}'", title)); return tempLink; }
asp.net-mvc canonical-link actionlink
RSolberg
source share