2

In Sitecore 8.1, I would like to align the download links to media items (files), as links can be outputted in two different ways for the same item:

  • Links with an ID
    • my.site.com/_/media/02aceb0428824eefa1d3f62b203fe65c.pdf?la=en
  • Links with a path
    • my.site.com/_/media/files/MySite/home/cards/downloads/data/reports-and-presentations/report.pdf

I would like to use the latter (the paths) in all cases, and as far as I can tell, the links with an ID originates from the Rich Text Editor.

enter image description here

The “Insert Sitecore Link” (in the red square above in the image above) produces two types of HTML output for links depending on how the media item is selected:

  • <a href="_/media/04aceb0428824eefa1d3f62b203fe65c.ashx">2015/16 pdf</a>
    • This type of link produces the link with an ID
  • <a href="~/link.aspx?_id=2B190C3D2C6F4B2395845D30ED6F3DD6&amp;_z=z" target="_blank" title="Dowload annual report 2012/13">2012/13 pdf</a>
    • This type of link produces the link with a path

If I use the “Search” tab to locate the media item, then the output is of the “path” type, but if I use “Internal link” or “Media items” and select a media item (document) then the output is of the “ID” type.

enter image description here

Is it possible to make the Rich Text Editor output links with a path (“/link.aspx?...”) in all cases? Alternatively, is it possible to make whatever is rendering the media links output the links with a path in all cases?

  • 3
    The links are rendered in the RTE for a reason: If the media item is moved then the path can be dynamically (re)generated and you don't end up with broken links. They should be expanded and rendered with the full path when viewing in normal mode and your CD servers. – jammykam Mar 27 '17 at 9:04
  • Take a look at this article. community.sitecore.net/technical_blogs/b/sitecorejohn_blog/…. It's old but still valid, and it will help you understand how these links are transformed in the final (web/CD) output. If in your case you are still getting the GUID for media items, it could be due to a custom link provider. – maz Mar 27 '17 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.