Autoroute/Alias getting full path

Topics: Writing modules
Apr 11, 2012 at 1: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 1: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 1:26 PM

Fantastic. Thanks.

Apr 11, 2012 at 3: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!