Issue
- Liferay 7.4 has introduced a new way of having friendly urls for documents: https://learn.liferay.com/web/guest/w/dxp/content-authoring-and-management/documents-and-media/uploading-and-managing/configuring-document-urls
-
Why doesn´t the friendly url of documents contain the filetype anymore? This way the friendlyurl could end with (example) my-file.pdf instead of my-file .
There are a lot of reasons why it makes sense to have the file extension in the URL: for web analytics tools like Matomo, for example.
Environment
- 7.4 U27+
Resolution
- Before this, the url was including the filename, so any change to the filename was causing a broken link in the content using those documents. In order to solve that, we added a new field called friendlyURL that works pretty much as friendlyURLs in web content and pages, having a history, so even if the friendlyURL is changed, users are redirected to the document. The reason to base the autogenerated url in the name and not in the full filename, was that the main use case we were considering was display page templates, where you build a “nice” page to show the documents information, so it is more SEO friendly if the url has a “beautiful” name and not something like “myReport.xlx”.
- Please also note that end users can always override the autogenerated URL when they upload/edit a document.