Routable Path Constraints

Topics: Administration, Customizing Orchard, General, Writing modules
Jul 13, 2011 at 9:58 PM

I'm having a hard time figuring out how path constraints are implemented via a module.  Here is my current need, would appreciate some help:

I have a content type called NewsItem, which is containable and has a routepart.  When I go to create a new news item, I get a url like this "~/{container path}/{news slug}".

What I want is "~/{container path}/news/{news slug}"

What do I need to implement to get this behavior?

Or do I need to jump through some hoops to make an intermediary "news" container (at "~/{container path}/{news}") and add the NewsItem to the intermediate one?  This would get difficult given my current admin ui strategy.  

Thanks!

Coordinator
Jul 13, 2011 at 11:48 PM

Implement a route. Good news is, we're making that a lot easier in Orchard 2.0 (you won't have to write a line of code for that sort of thing).

Jul 14, 2011 at 6:08 AM
Bertrand - just to be clear, will implementing a route actually affect the routable piece (ie the permalink) or just allow me to link to the news item and have it be routed properly on the front end?

Sent from my iPhone

On Jul 13, 2011, at 6:48 PM, "bertrandleroy" <notifications@codeplex.com> wrote:

From: bertrandleroy

Implement a route. Good news is, we're making that a lot easier in Orchard 2.0 (you won't have to write a line of code for that sort of thing).

Coordinator
Jul 14, 2011 at 6:49 AM

It won't affect the permalink in 1.x. For the permalink to be affected, you'd have to apply the same trick that some modules implement to include the container path, or wait for 2.0.