Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

To remove the selectors from url 'path/page.woo.foo.html" So what should be the syntax ? select two

Avatar

Level 7

a) ${ 'path/page.woo.foo.html' @removeSelectors[‘foo,bar’]}
b) ${ 'path/page.woo.foo.html' @removeSelectors{“foo”,”bar”,”woo”}}
c) ${ 'path/page.woo.foo.html' @selectors}
d) ${ 'path/page.woo.foo.html' @selectors=’’}

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Option C & D

${'path/page.woo.foo.html' @ removeSelectors='foo.bar'}
<!-- outputs: path/page.woo.html -->

${'path/page.woo.foo.html' @ removeSelectors=['foo', 'bar']}
<!-- outputs: path/page.woo.html -->

${'path/page.woo.foo.html' @ selectors}
<!-- outputs: path/page.html -->

${'path/page.woo.foo.html' @ selectors=''}
<!-- outputs: path/page.html -->

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#125-uri-manipulation

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Option C & D

${'path/page.woo.foo.html' @ removeSelectors='foo.bar'}
<!-- outputs: path/page.woo.html -->

${'path/page.woo.foo.html' @ removeSelectors=['foo', 'bar']}
<!-- outputs: path/page.woo.html -->

${'path/page.woo.foo.html' @ selectors}
<!-- outputs: path/page.html -->

${'path/page.woo.foo.html' @ selectors=''}
<!-- outputs: path/page.html -->

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#125-uri-manipulation

Avatar

Level 9

adding to this.

Options C & D -- If you want to remove all the selectors i.e foo, woo or any other value.
Options A & B -- They have incorrect syntax for given use-case due to how the quotes are provided around the selector values. If you have a scenario to remove specific selector from URL, A or B can be used provided the selector values are provided correctly i.e 'foo', 'woo' ...

Avatar

Level 2

The correct syntax to remove selectors from the URL 'path/page.woo.foo.html' would be option d) ${ 'path/page.woo.foo.html' @selectors=''} by setting the selectors to an empty string. This will remove all selectors and only retain the path and filename. Options a) and b) have incorrect syntax, while option c) retrieves the selectors rather than removing them.

 
 
 
Origin Data Hope we can help you!