I'm building a content API for a multi lingual site. We decided to go with a subfolder setup for each language. For example:
Default: mydomain.com/things-to-do/
Spanish: mydomain.com/es/cosas-para-hacer/
French: mydomain.com/fr/choses-a-faire/
This URL structure works fine when navingating to the page in a browser. However, using ContentCache.GetByRoute("/fr/") doesn't return any content, and neither does ContentCache.GetByRoute("/fr/", culture = "fr-FR").
Any ideas what I'm doing wrong?
As a side note; I noticed the following warning on the Cultures and Hostname panel:
One-level paths in domains are supported, eg. "example.com/en". However, they should be avoided. Better use the culture setting above.
...but it doesn't explain why they should be avoided (it's my understanding that this is common SEO practice). This warning is a bit vague, can any elaborate?
Minor update; I've had a dive into the source code and in the GetByRouteInternal method it again states:
// if in a domain then start with the root node of the domain
// and follow the path
// note: if domain has a path (eg example.com/en) which is not recommended anymore
// then /en part of the domain is basically ignored here...
Can anyone shed any light on why this is not recommended? Is it a technical issue with Umbraco? Or is Umbraco imposing some kind of opinions on us?
From the reasearch I've done, this seems to be the recommended way to structure multi-lingual sites these days.
Accessing Content Variants via UmbracoCache.GetByRoute
Hi guys,
I'm building a content API for a multi lingual site. We decided to go with a subfolder setup for each language. For example:
Default:
mydomain.com/things-to-do/
Spanish:
mydomain.com/es/cosas-para-hacer/
French:
mydomain.com/fr/choses-a-faire/
This URL structure works fine when navingating to the page in a browser. However, using
ContentCache.GetByRoute("/fr/")
doesn't return any content, and neither doesContentCache.GetByRoute("/fr/", culture = "fr-FR")
.Any ideas what I'm doing wrong?
As a side note; I noticed the following warning on the Cultures and Hostname panel:
...but it doesn't explain why they should be avoided (it's my understanding that this is common SEO practice). This warning is a bit vague, can any elaborate?
Any help is greatly appreciated. TIA!
Kind regards
Minor update; I've had a dive into the source code and in the
GetByRouteInternal
method it again states:Can anyone shed any light on why this is not recommended? Is it a technical issue with Umbraco? Or is Umbraco imposing some kind of opinions on us?
From the reasearch I've done, this seems to be the recommended way to structure multi-lingual sites these days.
is working on a reply...