The following code:
var canonical = new TagBuilder("link");
canonical.MergeAttribute("rel", "canonical");
canonical.MergeAttribute("href", url);
return new MvcHtmlString(canonical.ToString());
Creates a tag:
<link href="http://local.domain.com/" rel="canonical"></link>
Is it possible to render
<link href="http://local.domain.com/" rel="canonical"/>
instead, using TagBuilder?
ToString
. That worked, thank you. – Legation