Friendly and Permanent URLs for documents or images don't make sense

Tim Valdez asked on April 1, 2024 22:42

Custom MVC site under Windows. Would like to know how to get the "permanent" URL for Documents in the ML? Our ML has several Libraries, one is Documents and one is Images (which hold PDFs and JPGs respectively). When a web editor selects the "Insert/edit image or media" icon in the CMS they can not select anything from the Documents library, only from Images, and it gives them a single URL field to copy from in the preview window which is a Permanent link (/getmedia/...). Yet when they use the CMS "Insert/edit link" icon to select a PDF from the Documents library, it gives them only a Friendly link (/Kentico/Documents/...). Why is that? And how can I change something so that both libraries show BOTH the Friendly AND Permanent URL links for the web editors to choose from?

Recent Answers


Juraj Ondrus answered on April 2, 2024 06:02

It is because when inserting image or media - an IMG tag is used in the HTML so there can be a thumbnail displayed. This is not possible with documents so these are filtered out.
The URL format for media files of any type is being set in Settings -> Content -> Media -> Use Permanent URLs setting. ISn't it possible that the images selected are being resized? If yes, in this case the permanent URL is used automatically no matter what is set in the mentioned setting.

0 votesVote for this answer Mark as a Correct answer

Tim Valdez answered on April 2, 2024 18:13

Yes, images get resized.

So that means there is no method to generate a permanent URL for Documents? The problem is that people move the PDFs around a lot and that breaks a ton of webpage links, so using a "permanent" URL would stop that from happening and save a lot of work.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 3, 2024 06:17

Well, if you are resizing the images and using the permanent URLs for them, I would switch the media setting to always use permanent URLs for all media files.

0 votesVote for this answer Mark as a Correct answer

Tim Valdez answered on April 3, 2024 16:35

Except that the Documents are not shown as media files, otherwise people would be able to use the "insert image" icon to link them, but instead they have to use the "insert link" icon instead since you cannot select anything in that library unless you use that icon. If that made any sense.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 4, 2024 06:36

Where are the documents stored? Are they stored as page attachments or media files? As explained, when using insert image dialog, this creates IMG tag in the HTML code - which is not suitable for PDFs or other documents - that's why they are not displayed. So, when adding documents - you can link them as a standard HTML anchor tag - so you have to use the insert link dialog.

0 votesVote for this answer Mark as a Correct answer

Tim Valdez answered on April 4, 2024 16:33

Okay, so that means that Documents can never be linked using a Permanent URL link in this CMS. Got it.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 5, 2024 05:07

That is not true. If you set the media library setting to use permanent URLs as mentioned above, then all files linked from media libraries will be using permanent URLs. I understood that your "documents" are files in media library, right? So, if you want to use permanent URLs, set the media libraries to use them. Please, read the media library settings documentation.

0 votesVote for this answer Mark as a Correct answer

Tim Valdez answered on April 5, 2024 16:46

If that setting is changed will it affect any webpage links that are already published that use Friendly URLs?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 8, 2024 05:21

No, only newly added links will be respecting given setting. Already entered and saved links are not chaged.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.