Skip to content

Add Multi-domain routing support similar to Next.JS SDK so that default language is set for specific hostname #42

Open
@ivanbuzyka

Description

@ivanbuzyka

What would you add to the SDK?

Curently it is possible to set default language globally for the entire Head Application, see in Program.cs:

const string defaultLanguage = "en";
const string germanLanguage = "de-DE";
app.UseRequestLocalization(options =>
    {
        // If you add languages in Sitecore which this site / Rendering Host should support, add them here.
        List<CultureInfo> supportedCultures = [new CultureInfo(defaultLanguage), new CultureInfo(germanLanguage)];
        options.DefaultRequestCulture = new RequestCulture(defaultLanguage, defaultLanguage);
        options.SupportedCultures = supportedCultures;
        options.SupportedUICultures = supportedCultures;
        options.UseSitecoreRequestLocalization();
    });

Next.JS SDK has the way to configure default language per website domain/hostname, see this recipe for more information: https://developers.sitecore.com/learn/accelerate/xm-cloud/implementation/information-architecture/localization#multi-domain-routing-with-localization

This is useful functionality that allows more advanced multi-site configuration.
The scenarios like following are possible in Next.js but currently they are not possible for ASP.NET Core SDK:

  1. ASP.NET Core SDK app should serve 2 websites: www.test.nl and www.anothertest.de
  2. When visited, www.test.nl should set localization to NL so that content from layout service is delivered in NL language. No redirection or /nl-NL prefix should be used in the URL
  3. When visited www.anothertest.de should set localization to de-DE and the content should be delivered o de-DE version. Again, no /de-DE language prefix should be used in the URL.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions