Nested Wildcards to Handle Virtual Items in Sitecore

TLDR; What is the best or recommended way to work with complex virtual items at multiple levels?

I'm working on something currently that instead of using query string variables to filter properties, I would just like to extend the URL and allow those URLs to filter. Events: ~/events/2012/april or ~/events/lunches or ~/events/6CB27D08-358E-49AA-8107-16A50E963C70

I currently have a wildcard setup to handle the last case or the year but ran into the snag of a wildcard only handling one level so I'm unable to handle /events/{0}/{1} with just one wildcard. Further more, I believe that the common friendly url would end up being /events/2012/april/<external_id>_<event_name>

Using wildcards, I would need to put them three layers deep with three different layouts to handle each case from what I know currently

Events/
        *
          *
            *

Is there a better way or a more recommended way to deal with complex virtual items at multiple levels?

Answers


You are on the correct path here and you are correct in that you would need a wildcard item for each segment of the URL. However, just because a wildcard exists doesn't mean you need to use it. In other words, the /events/*/* item would handle the /events/2012/april URL.

You may want to look at this blog post http://www.sitecore.net/Community/Technical-Blogs/Getting-to-Know-Sitecore/Posts/2011/09/Wildcards-and-Data-Driven-URLs.aspx that leads to the Wildcard Module


Is there a specific reason for using the wildcard items? I think you are better off with URL rewriting if you're are going more than 1 level deep with wildcards.

So make only the /events item and rewrite /events/{0}/{1} to /events?year={0}&month={1}


Need Your Help

Entity Framework CTP5 and Ninject as my IOC

entity-framework ioc-container ninject entity-framework-ctp5

Is it possible in Entity Framework CTP5 to construct retrieved persisted entities via an IOC container?

MySQL: Excluding items in the same table collected in a subquery

mysql

What I'm trying to accomplish here didn't seem all too difficult, and in execution I don't see anything I'm doing wrong, but I'm getting some results that should negated from the result set.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.