Routing, localization, and multi-sites

After you render SitecoreAI content and enable visual editing, most solutions also need to resolve three things for every incoming request, before your app can make its layout query:

  1. Which site is being requested - every layout, item, or search query requires a site name argument, in both single-site and multi-site environments.
  2. Which language to request the content in.
  3. Whether the requested path is a redirect that a content author configured, rather than a page.

These are three separate, independent capabilities. Sitecore doesn't bundle them together. However, all three run on every request, early in your request pipeline, before you fetch layout data. That's why frameworks such as Next.js typically implement them together as a chain of middleware. Your framework may not have an equivalent middleware concept. The important part is running this resolution logic early, for every page request, and passing the results (site name, language, and any redirect decision) into your layout query and routing logic.

Get started

To get started with routing, localization, and multi-sites:

If you have suggestions for improving this article, let us know!