I am having a problem with canonical urls using the wrong domain on a multi-lingual site, and wondered if anybody had any suggestions.
The CMS is configured with a lot of different domains. Each market has a live domain and an origin domain (for the load balancer). If a market has a single language, then the live domain is set as the primary domain and assigned the language:
Host Name Culture Type origin-www.mysite.co.uk en-GB www.mysite.co.uk en-GB Primary
Using the canonical url function @Html.CanonicalLink() on the live domain generates correct canonical urls:
<link href="/mypage"rel="canonical" />
For a market that has multiple languages e.g. Belgium, the live domain is not set with a culture or set to primary. The language is toggled using a dropdown in the website navigation.
Host Name Culture Type origin-www.mysite.be www.mysite.be
Using the canonical url function @Html.CanonicalLink() on the live domain for these ones incorrectly generates a url containing the origin:
<link href="http://origin-www.mysite.be/nl-be/mypage" rel="canonical" />
I guess this is because there is no primary domain/language set up. In this case EPiServer seems to arbitrarily chose a domain from the list that has no culture set.
Is there anyway I can avoid this problem, or do I need to build my own canonical url function?