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:
- Which site is being requested - every layout, item, or search query requires a site name argument, in both single-site and multi-site environments.
- Which language to request the content in.
- 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:
- Learn about multi-site resolution, including how to retrieve your site list and match an incoming request to the correct site.
- Learn about locale resolution, including how language is passed to Sitecore queries, how language fallback works, and how to query the site dictionary and enumerate pages for static generation. See Add a language to your environment to make additional languages available before resolving them in your app.
- Learn about redirects, including how content-managed redirect rules are structured and matched.
- Complete the Implement routing, localization, and multi-sites walkthrough, where you add site, locale, and redirect resolution to the app you built in the previous walkthroughs.
- Review the troubleshooting topic for common issues.