This project is read-only.

Accessing a custom content item's slug

Topics: Customizing Orchard
May 27, 2014 at 5:06 AM
I'm relatively new to Orchard. I'm in the process of moving my main site to Orchard. It's a pretty basic site; I was using WordPress with static pages and a pretty heavily-customized front page template to manage things.

The main thing I talk about on this site is the other sites that I host or maintain. So, I thought, rather than just shoe-horn the "page" concept (which would have been easy, and I would already be done), I'd create a custom content type for each site or web application. I called this type Application, and included some text fields, a media picker field for the site thumbnail, and a taxonomy field for the type (Custom, WordPress, Orchard, etc.).

The detail template was interesting, but I finally figured out what all to do to get it to look the way the old site did. The template Content-Application.Detail.cshtml is rendering the individual pages (you can compare to for an example).

There is a page that lists all the applications as well (just /applications). To do this, I created a query that selected all taxonomies, and sorted by name. Then, I created a projection based on that query, and created a Content-Application.Summary.cshtml file to render each application. The problem I have now is that I cannot figure out how to get to the content item's slug. @Model.RoutePart.Slug doesn't thrown an error, but is blank; the application is @Model.ContentItem.Application, but @Model.ContentItem.Application.RoutePart.Slug throws an error with or without the RoutePart part.

Where is the slug?

(Also, if there is a place that spells out "This is how you get to the other part's properties on custom content types," I would love to be directed there. I have yet to find such a place.)

Finally, a couple of quick hits. Is it possible to sort by taxonomy weight -then- title? I'd love to do a control-break type process to make them look like the current /applications page instead of the way the "new" one looks. Also, would removing modules I'm not going to use improve the start-up time? Warm-up is nice, but when the initial hit is not the front page, it takes a while.

Thanks so much for your help; in my work on this, I've been pretty impressed with this project. I have a feeling that the more I wrap my head around the "Orchard way" of thinking about things, there will be a lot more things I can do.
May 29, 2014 at 3:37 AM
Well, I got the first part resolved by using @Html.ItemDisplayLink() method in the template.

Any thoughts on the other two questions?