Professional Documents
Culture Documents
from the Evil Empire Future Orchard Part 3: Autoroute
Future Orchard Part 3: Autoroute
Sunday, July 31, 2011
ASP.NET (/bleroy/Tags/ASP.NET) Orchard (/bleroy/Tags/Orchard)
The way URLs work in Orchard today is fine for the simplest sites but it's not very customizable and
comes with a number of challenges. Let's look at how it works today. Let's start with a plain page:
Once you're done typing a title, when you tab out of the title field, an ajax request is fired that asks the
server to do a fake publication of the page and get a slug out of the title. This happens in the Routable
part, and it is extensible by implementing ISlugEventHandler. There are a few problems with this.
First, the fake publication is creating some noise for subscribers to the publication event. It would be
better unfortunately to do away with the nice ajax behavior.
Second, it becomes really hairy once you introduce containers, such as lists or blogs. Should the path of
the contained object begin with the path of the container? Should the path recursively include the slugs
of all parent? When the path of the parent changes, does that mean the paths of all children change?
We had to come up with answers to all those questions and more, but the problem is that the answers
we came up with are fixed and there will always be people who disagree and they would be right.
This is why we are revising the whole URL infrastructure to make it highly configurable, a feature that we
call Autoroute. Mockups here are far from final by the way, so don't focus on UI or wording.
There will be a new setting on the Routable part type, so that you can go to the content type editor and
choose which pattern to use for each routable content type:
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 1/6
4/10/2015 Tales from the Evil Empire Future Orchard Part 3: Autoroute
Once you've configured your content type to use a specific pattern, the content editor will have
something like this:
If you leave the checkbox checked and save, the pattern will get applied and you will get something like
this:
Now if you uncheck the checkbox, then the path becomes editable and you can set it to just about
anything.
The set of patterns that you can use is configured on a separate settings screen. There, you can create
named patterns using Tokens (http://weblogs.asp.net/bleroy/archive/2011/07/22/futureorchardpart1
introducingtokens.aspx):
Finally, there is a third screen where you can find the full set of all paths that were generated.
This will enable you to recalculate paths in bulk. This is necessary because we made the choice this time
around that once a pattern has been applied to generate the path for a content item, that path is fixed. If
the path to the container changes for example, and the pattern you used depended on the container
slug, then the contained items won't change unless you make the conscious decision to reapply the
pattern.
Of course, this is all built on top of highly extensible APIs that can enable replacement of part or all of the
UI and behavior above, but this is what the feature should look like to users out of the box.
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 2/6
4/10/2015 Tales from the Evil Empire Future Orchard Part 3: Autoroute
19 Comments
very good.
when orchard 2.0 come?
— lonely7345 Sunday, July 31, 2011 8:44:41 AM (/bleroy/futureorchardpart3autoroute#comment490)
Early Spring 2012.
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Monday, August 1, 2011 1:20:33 AM (/bleroy/futureorchardpart3
autoroute#comment491)
Looking forward to it! really good.
— Jing Wu Monday, August 1, 2011 3:47:39 AM (/bleroy/futureorchardpart3autoroute#comment492)
Just wanted to say that I really like this new approach to routing / url generation! Now the tokens
feature makes even more sense to me as well.
Already can't wait for 2.0!
— Skywalker (http://thedutchpirates.com) Monday, August 1, 2011 5:51:39 PM (/bleroy/futureorchardpart3
autoroute#comment493)
preview version for 2012? or release version
i cant't wait too .hehe
— lonely7345 Tuesday, August 2, 2011 6:25:49 AM (/bleroy/futureorchardpart3autoroute#comment494)
Release.
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Tuesday, August 2, 2011 6:38:17 AM (/bleroy/futureorchardpart3
autoroute#comment495)
have the plan for preview version? and when?
— lonely7345 Tuesday, August 2, 2011 11:54:10 AM (/bleroy/futureorchardpart3autoroute#comment496)
First preview will be around September.
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Tuesday, August 2, 2011 8:43:15 PM (/bleroy/futureorchardpart3
autoroute#comment497)
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 3/6
4/10/2015 Tales from the Evil Empire Future Orchard Part 3: Autoroute
Thanks for sharing your thoughts on Autoroute here great to see what you guys are thinking
about for this important feature.
This is the one remaining reason I've yet to port my own blog from BlogEngine.NET to Orchard ...
... well, this and the issues I'm experiencing with Orchard's current pagination issues.
— Richard Turner (http://www.bitcrazed.com) Wednesday, August 3, 2011 10:27:31 PM (/bleroy/futureorchardpart3
autoroute#comment498)
Oh ... and are you using Sketchflow to prototype the UI here?
— Richard Turner (http://www.bitcrazed.com) Wednesday, August 3, 2011 10:29:06 PM (/bleroy/futureorchardpart3
autoroute#comment499)
@Richard: no, that's Balsamiq.
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Wednesday, August 3, 2011 11:27:00 PM (/bleroy/futureorchardpart
3autoroute#comment500)
Can you please make the url much more customizable? say if my site has several language
versions, and the content's going to have several titles repectively for each language version, I'd
like the url for each language version be different just based on each of the language version's
title.
— Shawn Sunday, September 4, 2011 4:43:06 PM (/bleroy/futureorchardpart3autoroute#comment501)
Also, can you please make the date time format more localizable on the admin ui rather than hard
coded it in the code like this? This makes the translated datetime format much less human friendly.
I think you can copy the way ScrewTurn wiki handles datetime format when setting up a new wiki.
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value) {
//TODO: (erikpo) This default format should come from a site setting
return htmlHelper.DateTime(value.ToLocalTime(), new LocalizedString("MMM d yyyy h:mm tt"));
//todo: above comment and get rid of just wrapping this as a localized string
}
— Shawn Sunday, September 4, 2011 4:47:55 PM (/bleroy/futureorchardpart3autoroute#comment502)
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 4/6
4/10/2015 Tales from the Evil Empire Future Orchard Part 3: Autoroute
Also can we work around a better way to handle the orchard localization? currently the localization
works like word by word translated which really makes the final translated words unreadable in its
context, I mean can we do it pattern by pattern with the some context info included rather than
word by word, which might make more sense to help people spread this great work to every corner
of the world.
— Shawn Sunday, September 4, 2011 4:53:17 PM (/bleroy/futureorchardpart3autoroute#comment503)
@Shawn: yes, the localization part can expose tokens that you will be able to use int your URL
patterns.
For the date time format in the admin, a patch would be more than welcome.
Finally, what do you mean by "word by word translated"?
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Monday, September 5, 2011 4:56:09 AM (/bleroy/futureorchardpart
3autoroute#comment504)
"word by word translated": say for example, if we go to the installed themes, there are the authors'
names right under the themes' names, and it goes like "By jowall, mibach, loudej, heskew" and
here the word "by" is always translated separately, and that would be impossible for the user to
figure out what it really means.
— Shawn Monday, September 5, 2011 6:19:59 AM (/bleroy/futureorchardpart3autoroute#comment505)
No, that's not true. Translations are full sentences and they have the context of what file they were
defined in right next to them. I'm wondering what could have given you that impression.
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Monday, September 5, 2011 6:29:24 AM (/bleroy/futureorchardpart
3autoroute#comment506)
I understand that what you have described here would provide flexibility and power and I am so
pleased at Orchard's priority to just getting the code really good so it can be built on. Wouldn't it
also be cool to have a tree view showing all the different routes for the website presenting the
content for the website just like good old windows explorer?
Is something like that on the cards?
— Ben Monday, September 12, 2011 10:31:27 AM (/bleroy/futureorchardpart3autoroute#comment507)
@Ben: there is a new route debugging module on the gallery that you will probably like then...
— Bertrand Le Roy (http://weblogs.asp.net/bleroy/) Wednesday, September 14, 2011 8:32:53 PM (/bleroy/futureorchard
part3autoroute#comment508)
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 5/6
4/10/2015 Tales from the Evil Empire Future Orchard Part 3: Autoroute
Comments have been disabled for this content.
Terms Of Use (http://www.asp.net/termsofuse) Powered by Orchard (http://www.orchardproject.net)
https://weblogs.asp.net/bleroy/futureorchardpart3autoroute 6/6