Experience Sitecore ! | All posts tagged 'Media-aliases'

Experience Sitecore !

More than 200 articles about the best DXP by Martin Miles

Media Aliases in Sitecore 8.2 Update 1

With recent release of Sitecore 8.2 Update 1 we have got a really much fun on Azure and getting closer to PaaS. it was so much buzz about it at #Sitecore Twitter, so that another handy feature has been overlooked. I am now talking about Media Aliases in Sitecore. One would probably ask few questions about that;

- Haven't we had it previously in Sitecore, wasn't that doable in principle?
- It wasn't, at least not out of the box. Previously if you wanted to achieve that functionality you had to implement your own ItemResolver pipeline processor and combine that with MediaProvider so that the links to media items were generated using aliases. That required custom code being built and re-deployed, that was especially painful for solutions already live. Of course such an approach couldn't be called an easy way.

- But why at all do I need Media aliases?
- Good question. Why would you use normal aliases with Sitecore then? You may find yourself working with the platform for few years so far without even thinking about that functionality. However otherwise like me, you may have a SEO Maniac as your manager (in good sense of word "maniac", for sure) who constantly generates optimization tasks for you. In my case I also had a Marketing Department who wanted to have nice and simple URLs for certain features, so that they can easily tell that over the phone.

- Still didn't get that. Would it be better just to demonstrate an example of very obvious use case?
- Without any problems. For the sake of this experiment, I have installed clean vanilla Sitecore 8.2 update 1. With that instance, I want to host my professional CV and easily tell that URL to numerous employment agents so that they could get that URL straight away or even remember it. I also want to make it as simple and minimal as possible. So that people type an URL and immediately get the PDF document downloaded. And of course, I don't want to have any file extension in URL or anything that complicates.
That is an ideal scenario for implementing Media Alias. It is indeed very easy, below are few steps how to make it work:

  1. Navigate to /Sitecore/System/Aliases and create a new child item of type Alias. Give the item simplest name you can, but avoid that name matching any of existing pages, as in that case alias would take a priority and a page becomes unreachable.
  2. While editing alias item, click Insert media link in order to open Insert media link dialog box.
  3. Select (or upload if required) correspondent Media Item that will be processed.
  4. Hit Insert button. That's it - your new Media Alias is ready
  5. Do not forget to publish your alias (and media item) so that it becomes available from Content Delivery database(s).



As soon as I completed these 5 steps, I can now able to download my CV in one click with nice and clean URL: http://sandbox/cv Also, I want to warn that Media Aliases have the same limitations as the normal ones.



That's it - nice, clean and simple.
I hope Media Aliases will help you to deliver even more user-friendly solution!