Skip to content

Instantly share code, notes, and snippets.

@aolde
Created November 12, 2013 20:22
Show Gist options
  • Save aolde/7437996 to your computer and use it in GitHub Desktop.
Save aolde/7437996 to your computer and use it in GitHub Desktop.
These urls work:
- /News-Search/TechForum/Stockholm/
- /News-Search/TechForum/
- /News-Search/
routes.MapContentRoute(
name: "Search",
url: "{language}/{node}/{event}/{location}/{action}",
defaults: new { action = "Index", @event = UrlParameter.Optional, location = UrlParameter.Optional },
parameters: new MapContentRouteParameters {
Constraints = new { node = new ContentTypeConstraint<SearchPage>(matchInheritedTypes: true) }
}
);
public class SearchController : PageController<SearchPage>
{
public ActionResult Index(SearchPage currentPage, string @event, string location)
{
return Content(string.Format("{0}: {1} in {2}", currentPage.PageName, @event, location));
}
}
[ContentType(GUID = "3FE318E2-2522-4949-914C-2B44B2C6EE55", DisplayName = "Search Page", GroupName = "Content")]
public class SearchPage : PageData {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment