actionlink - Adding rel and title to ASP.NET MVC Action Links -


I have decided to add "Reliance Energy" mainly to my action link for SEO reasons, but I'm not sure That's the way I have gone about this "best practices." I just created a new extension method as shown below.

Is it the best way to go about doing this? Are there any things that should be modified in this approach?

VIEW

  & lt;% = html.ActionLink ("Home", "Index", "Home"). Add (" Me ") .AddTitle (" Russell Solberg ")% & gt;   Extension methods   
  public static string AddRel (this string link, string relay) {var tempLink = link.Insert ( Link.IndexOf ("& gt;"), String.Format ("rel = '{0}'", rel)); Return temple link; } Public Static String AddTitle (this string link, string title) {var tempLink = link.Insert (link.IndexOf ("& gt;"), String.Format ("title = '{0}'", title)); Return temple link; }  

You can add any additional HTML parameters very easily and need to write Do not have their own extension methods

  & lt;% = html.ActionLink ("home", "index", "home", empty, new {title = "Russell Solberg", rel = "Me"})% & Gt;  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -