I thought I'd post this l razor snippet that I've put into our site to ensure that every page has a canonical href for search engines, irrespective of how they got there and what magical querystrings were apended along the way.
Hope its of some use to others (just plonk it in the <head> of your templates):-
Razor Canonical Link Snippet
Hi
I'm new the the community so firstly, hello!
I thought I'd post this l razor snippet that I've put into our site to ensure that every page has a canonical href for search engines, irrespective of how they got there and what magical querystrings were apended along the way.
Hope its of some use to others (just plonk it in the <head> of your templates):-
<umbraco:Macro runat="server" language="cshtml">
@{
string canonicalHref = "http://www.mydomain.com" + @Model.NiceUrl;
<link rel="canonical" href="@canonicalHref" />
}
</umbraco:Macro>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.