Disable 'Tags' and 'Search' uris

Topics: Customizing Orchard, Writing modules
Jul 13, 2012 at 11:15 AM

How can I disable the default handling of /tags and /search so that it'll be as if no routes are defined for those paths?

I know how to override them, but I want to make the path 'available' for regular content

Coordinator
Jul 13, 2012 at 11:48 AM

Disable the features?

Jul 13, 2012 at 11:49 AM

I use the tags themselves + some of the services from Orchard.Search so I cannot do that.

Coordinator
Jul 13, 2012 at 11:57 AM

OK, I'm not sure I see the point of removing those then, but if you really want to do that, just register the same route, with a higher priority and send them to oblivion.

Jul 13, 2012 at 1:07 PM

You mean let the route point to a non existing action for example? Will it show my content then that resides on /search or /tags?

We're using the Orchard search system but the search 'view' is put inside a field that we put on the 'Search' page. So we don't want to use the 'real' search page, but we do want to use the '/search' path for this custom page.

We just included '/tags' in this question, as I the solution for '/search' would be applicable to the '/tags' thing as well. 

Coordinator
Jul 13, 2012 at 1:16 PM

I mean point it to an action that returns a 404 result, or to your own action that performs a replacement for the default one. I don't understand what you mean by " Will it show my content then that resides on /search or /tags".

Jul 13, 2012 at 1:23 PM

I have a content item (lets call it 'Page') that has a route of /search but when you request /search the search module takes over :/

I need it to let it show our page instead

Coordinator
Jul 13, 2012 at 1:38 PM

Right, that is not at all what I recommended you do.

Jul 13, 2012 at 1:40 PM

Why not? I just want to be able to use the search module for its services and show 'content' on /search, and the question remains : how?

Coordinator
Jul 13, 2012 at 1:47 PM

I already told you how: hijack the route by giving your own a higher priority, and point it to your own controller action. That action can do what Orchard.Core.Contents.Controllers.ItemController.Display(int id) is doing.

Jul 13, 2012 at 1:48 PM
Edited Jul 13, 2012 at 1:50 PM

I know how to point a route to an action, but I don't know how to make it point to content.

Anyhow, I added a new 'feature' to the Orchard.Search module that, if not enabled, will prevent the route from registering and disables the controller in its whole. This resolves this issue for us, but I'd still like to know how to route to a specific content item.

Coordinator
Jul 13, 2012 at 1:51 PM

:) I just told you: "That action can do what Orchard.Core.Contents.Controllers.ItemController.Display(int id) is doing."

Jul 13, 2012 at 1:53 PM

Meh sorry, just saw the notification of gmail and it cut that bit of, went to this page and ignored the fact that you could have said more (and you did) :/

Coordinator
Jul 13, 2012 at 1:56 PM

No trouble. Made me chuckle :D