A Page Works, But Is the URL Right? Rethinking Routing in SitecoreAI
A Solution Architect's perspective on route resolution, data fetching, and sitemap consistency in Content SDK applications.
The Problem Usually Appears After the Page Is Built
Imagine we are working on an enterprise website using SitecoreAI Content SDK and Next.js.
The development team has completed the product pages. Content authors can create new pages, update components, and publish content without requiring frontend changes.
Everything looks fine.
Then, during a pre-production review, someone from the SEO team raises a question:
"Why is the URL in our sitemap different from the URL we want customers to use?"
The content team has configured a friendly display name for the page, but the sitemap still follows the underlying Sitecore item name.
The page itself may work correctly, yet something is inconsistent.
This is a good example of why routing deserves attention during architecture design rather than becoming a last-minute SEO activity.
Understanding How Routing Works in SitecoreAI
In SitecoreAI, the content tree plays an important role in determining the website's URL structure.
Consider a simple content hierarchy:
Home
└── Products
├── Mutual Funds
├── Exchange Traded Funds
└── Retirement SolutionsSitecore uses the content hierarchy and its URL mapping configuration to determine the corresponding routes.
In a Next.js application, the routing layer needs to resolve those URLs to the correct Sitecore content items.
Content SDK supports this through the framework's routing capabilities, including catch-all routes and route resolution.
When a visitor opens a page such as:
/products/mutual-funds
The application resolves the requested path, retrieves the corresponding Sitecore layout and content data, and passes that information to the rendering layer.
The frontend then composes the page using the registered React components and placeholders.
The route identifies the content. The layout data describes the page. The frontend renders the experience.
These responsibilities are closely connected, but they should remain clearly separated in the architecture.
What Happens Behind the Scenes?
Let's follow a visitor opening a product detail page.
The request first reaches the Next.js application.
The route resolution layer identifies the Sitecore route associated with the requested URL.
Content SDK then uses GraphQL through its layout service to retrieve information from the appropriate Sitecore Edge or Preview API.
The response includes the page layout, component field data, and relevant context such as site and language.
That information is passed to the React rendering layer.
This approach allows the website to remain content-driven without developers creating a separate Next.js route file for every Sitecore page.
For a large multi-site implementation, this is an important architectural advantage.
The Interesting Part: Item Names Versus Display Names
Now consider a practical requirement.
A Sitecore content item has the following name:
investment-products
But the business wants customers to see a more descriptive URL based on its display name.
SitecoreAI Content SDK supports display-name-based routing starting with version 1.1.
This gives content teams more flexibility when designing meaningful and localized URLs.
However, enabling display-name-based routing introduces another consideration.
The sitemap generation process must follow the same routing strategy as the application.
Otherwise, we can end up with a mismatch between the URLs visitors use and the URLs submitted to search engines.
From a Solution Architect's perspective, this is not simply an SEO configuration problem.
It is a consistency problem across the content model, routing layer, and search discovery process.
Making Sitemap Generation Consistent
Sitecore's documentation describes a configuration-based approach to generating sitemaps for display-name-based routes.
The implementation involves updating the Sitecore LinkManager configuration using a patch file.
One important configuration attribute is:
useDisplayName="true"The approach includes configuring the appropriate localized link provider, deploying the configuration change, and updating the sitemap settings in Sitecore Content Editor to reference that provider.
There is one important behavior to understand before making this change.
Once the documented configuration is applied, the sitemap generates display-name-based routes rather than standard item-name-based routes.
This deserves careful validation, especially when an existing production website already has indexed URLs.
It should not be treated as an isolated configuration update.
What Would I Consider as a Solution Architect?
There are four areas I would review before approving this type of implementation.
1. Establish a consistent URL strategy
Decide whether the website will use item names or display names for its public URLs.
This decision should be aligned with business requirements, localization needs, and SEO expectations.
2. Treat routing as a shared responsibility
When implementing custom routing behavior, coordinate changes across Sitecore configuration, Content SDK, and Next.js.
A route that works on the published website should also work correctly within the Sitecore editing environment.
3. Validate the sitemap against actual routes
I would include sitemap verification in the release checklist.
The team should check whether sitemap URLs resolve successfully, follow the intended language and site structure, and match the selected routing strategy.
For existing websites, canonical URLs and required redirects should also be reviewed.
4. Consider the impact of URL changes
Changing a URL is not always a harmless content update.
It can affect bookmarks, external references, internal links, analytics reporting, and search engine indexing.
For an existing production platform, a URL migration strategy may be necessary before switching routing conventions.
A Small Configuration, a Broader Responsibility
One thing I have learned from working with headless implementations is that a page rendering successfully does not always mean the complete digital experience is working correctly.
A page can display the right content while its routing, redirects, metadata, or sitemap remains inconsistent.
These issues may not appear during regular component testing.
They often become visible during SEO reviews, integration testing, or production validation.
That is why route design, content delivery, and search discoverability should be considered together.
SitecoreAI Content SDK provides a structured way to connect Sitecore-managed routes with modern Next.js applications.
But the real architectural responsibility goes beyond fetching data and rendering a page.
We also need to ensure that the URLs generated by Sitecore, resolved by the frontend, and published through sitemaps represent a consistent experience.
For a Solution Architect, the objective is to make routing predictable for developers, manageable for content authors, and reliable for visitors and search engines.
A page is not fully integrated simply because it renders correctly. Its URL, content, and discoverability should tell the same story.

No comments:
Post a Comment