Handle links without .html extension
We have a dialog to select pages or assets from the content tree using the xtype pathfield. The purpose of the selection is to create a link on a page. Since assets are saved with the extensions, and pages aren’t, the link correctly directs the user to the assets, but not to the pages (because the page url doesn’t have the HTML extension).
These are the solutions we considered so far::
1 - linkPattern property in the dialog, to automatically append the HTML extension to the selected node. The problem is that it is also applied to assets, resulting in a wrong path (e.g. /content/dam/mysite/photo.jpg.html).
2 - Rewrite URL for page requests, using Apache (/content/mysite/home -> /content/mysite/home.html). It would fix the problem, but since we have a shared environment, we try to avoid any solutions that may affect other sites.
3 - Using https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html. It would map extensionless urls and redirect to the correct link with the HTML extension. The mapping would be done only under this site.
4 - Create a workflow triggered by page creation. It would set a vanity url to the same path without the extension.
It there a better solution to solve our problem? The best would be something simple to configure (one point) and restricted to the site structure.
