I'd like to allow authors to specify the href of a link by either using the pathbrowser to browse to a path on the site like /content/site/path/to/page, or pasting in an external URL, like http://www.example.com. In the first case, I would want to append .html; in the second, I wouldn't. This seems like a reasonably common scenario, so I was thinking there might be some OOTB support, either in Java APIs, or Sightly/dialog functionality. I haven't found anything yet - is there anything? Or ACS Commons? (I'm using AEM 6.1 and Touch UI)
Solved! Go to Solution.
Looks like this has been raised as a bug [SLING-7548] HTL url manipulation for external link without extension - ASF JIRA
You can use @ extension attribute in sightly
Example:
Will add .html to the internal page url
<a href="${ '/content/project/en' @ extension='html'}">Internal Link </a>
Will not add .html to the external domain url
<a href="${ 'http://www.adobe.com' @ extension='html'}">External Link </a>
Have you tried that against v6.1? My test was showing the latter example DID add .html to the external URL.
Views
Replies
Total Likes
I just ran a few more tests, and looks like this is functionality that updated in 6.3. 6.1 and 6.2 append .html to everything, 6.3 distinguishes between internal and external links.
Views
Replies
Total Likes
I am having the same issues here - entry pages seem to work fine, but anything deeper gets the .html added to the URL.
<a href="${ '/content/myproject/en' @ extension='html'}">Internal Link</a> Adds the .html extension [correct]
<a href="${ 'https://www.adobe.com' @ extension='html'}">External Link</a> Does not add the .html extension [correct]
<a href="${ 'https://www.adobe.com/uk' @ extension='html'}">Deeper External Link</a> Adds the .html extension [not right]
This does seem like a bug - unless we are doing it wrong. In which case is there a better way to output a link correctly that could be either external or internal?
Looks like this has been raised as a bug [SLING-7548] HTL url manipulation for external link without extension - ASF JIRA
Views
Likes
Replies