AEM 6.5: HTL @ extension = 'html' doesn't work for external links

Answers (3)

Answers (3)




I do not think that HTL has such functionality to distinguish internal/external links. You will need to write something custom to handle case a use case. Take a look at this [1] to help you in creating this customization.



17-09-2019 The documentation on this page says "The @extension works in all scenarios in AEM 6.3, before you could have a result like and also checks whether to add or not add the extension." The use case is that we dont want to add html to external links. Is that something which cannot be solved using @ extension?




As per my understanding and the sly documentation at [1], @extension will add the extension to the path. So, this is working as expected.

URL manipulation

Adds the html extension to a path.

<a href="${item.path @ extension = 'html'}">${}</a>

Adds the html extension and a selector to a path.

<a href="${item.path @ extension = 'html', selectors='products'}">${}</a>

I tried the following on my side:

  ${'' @  extension='html'}

The output is below:

Screen Shot 2019-09-17 at 8.52.23 PM.png

[1] HTL Block Statements