Alias fork new Name property idea

Topics: Core, General, Writing modules
Jul 3, 2012 at 10:14 AM

I've created a fork of the Orchard.Alias module and created a extra property called "Name":

The purpose of this property is to have a reference identifier to get the full url path for use in Code. I often have to created links to pages in views. Currently i have those url's also hardcoded in code but this solutition is much nicer. Now i can point to for example "NewsPage" without querying the full contentitem for it. It's also possible to use content item Id but that's also hardcoded and not safe.

What do you guys think of this solution? 

Jul 3, 2012 at 10:25 PM

I think that's sweet, simplifying and awesome. I assume the Name will be optional right? It should be part of Orchard.Alias, because I need this too :)

Jul 4, 2012 at 6:30 AM
Edited Jul 4, 2012 at 6:46 AM

yes it is optional and it's already usable just for testing purposes.

I've added the name property to the routecollection so i had to make only little changes to the existing code. We can rewrite that if needed because now the Route Path contains the name parameter (not that bad i supose).

Jul 4, 2012 at 10:28 AM

Also see the media management discussion. There is a need for general content item tokens, i.e. tokens that reflect some data (there: the display shape; here: the alias) of a specific content item. This is a related topic; I think you'd rather need to reference specific content items, then fetch their url, not their alias entries directly.

Jul 4, 2012 at 10:43 AM

That's a good idea. Though only if it's possible to get a url by it's token and without any database queries. otherwise i think the name property is better.