Hi,
I'm attemping to add a custom segment in the middle of an url. Consider the two urls:
/products/consumer/bikes
and /products/business/bikes
I would like both urls to route to the same page in Episerver CMS.
The cms page structure is:
- Products
- Bikes
The consumer and business part of the url is added to the RouteData object in the request context. I believe I have the correct logic for this implemented in a custom segment class that extends the SegmentBase class.
However, what URL should I use when registering this custom segment to the route table? I have tried {language}/{node}/{customertype}/{partial}/{action} but it does not seem to match the mentioned urls to the Bikes-page.
RouteTable.Routes.MapContentRoute(
name: "CustomerTypeSegment",
url: "{language}/{node}/{customertype}/{partial}/{action}",
defaults: new { action = "index" },
parameters: parameters
);
The normal behaviour of the Episerver pages route will render the bike-page when hitting /products/bikes
, however I am looking for the same behaviour using /products/consumer/bikes
or /products/business/bikes
. Is this even possible to do using only url segments? Or do I need to implement a custom PartialRouter?