we are approaching Kentico MVC development after 10+ years of Kentico development.
I liked your approach to routing but have you any idea about using it in a multi language web site? I know I should include a culture reference in the url pattern but at the same time I noticed that the pagealias (nodealias) is the same in all cultures so it's not very SEO and user friendly. So I looked to alternative URLs and saw I can define N alternative URLs for every page but I don't know how to manage them if had to use it dynamically on the site (eg. a menu)
Lead Product Evangelist @Kentico, Founding partner @craftbrewingbiz. love to learn / teach web dev & software engineering, collecting vinyl records, mowing my lawn, craft 🍺
Still use NodeAliasPath routing, and separate the culture from the URL when the route constraint is applied. You could then store the culture in a service to be used later in the request (like when querying the database).
Check out the DynamicRouting project that Trevor Fayas has been working on, which is a much more full featured and robust approach than what I have presented here.
For option 1, you're querying will be more complex, and you'll probably want to have a well defined way for finding culture segments in URLs and separating those from the NodeAliasPath part. But, choosing this option will let you get going with a lot less infrastructure.
For option 2, well that project is still in development, but Trevor is making rapid progress. It actually uses a very similar attribute approach to routing that I show here (I did the attribute integration in Trevor's project). The DynamicRouting project supports URL generation and customization in the CMS far beyond what Kentico provides out-of-the-box.
I also remember Dmitry Bastron mentioning on Twitter (in the conversation linked in the comment above) that he has done this kind of routing while also taking into account the culture, so maybe ask him if he has some tips?
Generating page links / URLs is another challenge altogether. I have a blog post detailing some of my explorations and solutions there that you might want to check out.
I've been able to create CMS managed dynamic menus with this approach.
If you aren't in the Kentico Slack account, I'd recommend joining (link also in the comment above). It can be a great place to get some help on these things.
Hello Sean,
we are approaching Kentico MVC development after 10+ years of Kentico development.
I liked your approach to routing but have you any idea about using it in a multi language web site? I know I should include a culture reference in the url pattern but at the same time I noticed that the pagealias (nodealias) is the same in all cultures so it's not very SEO and user friendly. So I looked to alternative URLs and saw I can define N alternative URLs for every page but I don't know how to manage them if had to use it dynamically on the site (eg. a menu)
Yuri,
Thanks for reaching out!
There's a couple of options here.
Still use
NodeAliasPath
routing, and separate the culture from the URL when the route constraint is applied. You could then store the culture in a service to be used later in the request (like when querying the database).Check out the DynamicRouting project that Trevor Fayas has been working on, which is a much more full featured and robust approach than what I have presented here.
For option 1, you're querying will be more complex, and you'll probably want to have a well defined way for finding culture segments in URLs and separating those from the
NodeAliasPath
part. But, choosing this option will let you get going with a lot less infrastructure.For option 2, well that project is still in development, but Trevor is making rapid progress. It actually uses a very similar attribute approach to routing that I show here (I did the attribute integration in Trevor's project). The DynamicRouting project supports URL generation and customization in the CMS far beyond what Kentico provides out-of-the-box.
I also remember Dmitry Bastron mentioning on Twitter (in the conversation linked in the comment above) that he has done this kind of routing while also taking into account the culture, so maybe ask him if he has some tips?
Generating page links / URLs is another challenge altogether. I have a blog post detailing some of my explorations and solutions there that you might want to check out.
Kentico 12: Design Patterns Part 13 - Generating Page URLs
Sean G. Wright ・ Sep 16 ・ 9 min read
I've been able to create CMS managed dynamic menus with this approach.
If you aren't in the Kentico Slack account, I'd recommend joining (link also in the comment above). It can be a great place to get some help on these things.
Cheers!
As you know, the Dynamic Routing is now finished and on NuGet and can handle Cultures perfectly fine, along with any pattern really.