Loading...
Area: Optimizely CMS
Applies to versions: 10 and higher
Other versions:
ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.

Partial routing

Recommended reading 
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.

Partial routing lets you extend routing beyond pages. You can use partial routing either to route to data outside Optimizely CMS or to route to other content types than pages.

For example: http://site/News/Sports/TheGame/. The http://site/News/ part can represent the URL to a page instance of model type NewsContainer. Then, by registering a partial router for ModelType NewsContainer, the partial router can take care of routing the remaining part of the URL: Sports/TheGame/.

The IPartialRouter interface

Each partial router must implement the interface EPiServer.Web.Routing.IPartialRouter<TContent, TRoutedData>, which resides in the EPiServer.dll assembly. The interface is a generic interface with generic constraints where TContent : EPiServer.Core.IContent.

The interface contains the following methods:

  • RoutePartial Called when the ordinary page routing has routed to a page of type TContent and there is a remaining part of the URL. The implementation can then route the remaining part of the URL.
  • GetPartialVirtualPath Called when an outgoing URL is constructed for a content instance of type TOutgoing.

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Jul 02, 2021

Recommended reading