Override Blog Routes and Controllers

Topics: Customizing Orchard, Troubleshooting
Sep 17, 2012 at 5:04 PM

I have added a blog to my Orchard site and I'd like to do some overriding.

I have updated my blog slug to "/News". When I navigate to that url by default, it gives me the blog description, and a top X listing of the latest blog posts. What I'd like instead is for /News to show a Detail view of the single latest blog post (and not necessarily re-route me to /News/latest-blog-post-title). 

I thought about using a projection page with its slug as /News, but then I'd have to change my blog slug to something else (/News-Blog), and manually manage my blog posts to show as /News/title instead of /News-Blog/title. 

I've tried creating my own route inside of a local Routes.cs and calling my own Controller, but Orchard then rebuilds my links to be /area/controller/action?blogId=#. I want it clean and simple - /News.

I've looked at overriding BlogPartHandler too, but I don't know that I did things correctly.

Any tips or ideas?

Coordinator
Sep 17, 2012 at 5:08 PM

Did you try Alias UI?

Sep 17, 2012 at 5:17 PM

I didn't even know about Alias UI. Thanks, Bertrand. I'll see where that gets me.

Sep 17, 2012 at 5:38 PM

Alias UI worked great!

I overrode the mapped route from /Blogs/Blog/Item?id= to my custom /Area/Controller/Action?id= route and everything worked like a charm.

Coordinator
Sep 17, 2012 at 5:44 PM

Alias is awesome :)