This project is read-only.

Autoroute/Alias getting full path

Topics: Writing modules
Apr 11, 2012 at 2:01 PM

I have been putting off updating a document management module I developed for our in house use that relies HEAVILY on the route part. But as we are in the feedback phase of our other orchard projects now seemed as good a time as any. Problem is I am not seeing how to get the path to the content item. I'm betting it's a service I need to inject but again I'm not seeing it. Help?

(I am sure the answer to my question is somewhere in these discussion posts, but I am not seeing that either :)

Apr 11, 2012 at 2:12 PM

There is an extension method for UrlHelper. You can use it from Razor views like this:

<a href="@Url.ItemDisplayUrl(myContentItem)">Click Here</a>

where myContentItem is a ContentPart, or Content Item. 

Apr 11, 2012 at 2:26 PM

Fantastic. Thanks.

Apr 11, 2012 at 4:23 PM

It turns out what I was actually looking for was the DisplayAlias property of the AutoroutePartRecord. And replacing the RoutePart with the AutoroutePart anywhere I was using it works quite well!