Assuming EngControllerAction refers to a page in the CMS site tree.
Optimizely page routing overrides MVC for any controller inheriting from: EPiServer.Web.Mvc.PageController<T> where T : PageData
Optimizely routing will map each localised version of the URL to the same Action.
Ah - no. There are several actions on the page - it's a multi-step wizard. So, `/en-gb/forms/controller/EngControllerAction` is one end-point - where "controller" = typeof ControllerPage.
I'll be wanting to call `/en-gb/forms/controller/EngControllerSecondAction` & `/en-gb/forms/controller/EngControllerThirdAction`, with the ability to change all of those final action parts to a localised (CMS configured?) alternative.
Get ya now!
The Route MVC attribute wont work with CMS routing to the best of my knowledge.
A Partial Router for this page type is worth considering as you can customise the routing: How To Set-Up A Partial Router - Jon D Jones
In the Partial Router you would need to map the expected translated strings to the desired action method. You could manage these as a CMS setting on the page type
Avoiding routing customisations and agreeing language agnostic naming conventions for steps is worth considering :)
Hi Sam,
I would take a look at using a Partial Router. https://world.optimizely.com/documentation/developer-guides/CMS/routing/partial-routing/
Using this you have access to the segments after the content segment, at which point you can then control the behaviour, this doesn't have to relate to specific actions on your controller.
Hope this helps
Andy
Hi folks,
I was wondering if it was possible - and if so, how might it be written - to attach multiple, dynamic routes to a single controller action. And as a bonus, could this be driven by CMS property values?
My scenario is: I have a controller action - let's call it "EngControllerAction" - on a multi-language site that I access via the route `/en-gb/forms/controller/EngControllerAction`. The "forms/controller" parts are slugs in my content tree.
I would like to be able to access that action in, say, my French site variant using a suitably translated route e.g. `fr-fr/les-forms/le-controller/FreControllerAction`. I know I can change the slugs in the translated page, but the action controller name is proving a challenge.
I'm aware of potentially using a `[Route()]` decorator but I'm not entirely sure how to format that. Also, if it were in any way possible, we'd like to make the action aliases configurable within the CMS to allow content editors to change if they wish to do so.
Any advice or guidance much appreciated...