Hi,
I need to use data-sly-resource to import some custom components.
I'm using this snippet:
<div data-sly-resource="${'link' @ resourceType='my-project/components/link-large', decoration=true}" data-sly-unwrap></div>
In this case the data-sly-unwrap attribute doesn't seems to work. The result is:
<div class="link">
<a>...mycomponent</a>
</div>
What I missed?
Solved! Go to Solution.
Views
Replies
Total Likes
hi @Giuderos1 ,
The data-sly-unwrap attribute in HTL is used to remove the wrapping element when including a resource using data-sly-resource. In your case, it seems that the data-sly-unwrap attribute is not working as expected.
Simply use -
<sly data-sly-resource="${'link' @ resourceType='my-project/components/link-large', decoration=true}"></sly>
hi @Giuderos1 ,
The data-sly-unwrap attribute in HTL is used to remove the wrapping element when including a resource using data-sly-resource. In your case, it seems that the data-sly-unwrap attribute is not working as expected.
Simply use -
<sly data-sly-resource="${'link' @ resourceType='my-project/components/link-large', decoration=true}"></sly>
Sorry, but even this solution is not working, the wrapping div is still there
Views
Replies
Total Likes
Hi @Giuderos1 ,
You can use data-sly-unwrap="${true}", It will work.
<div data-sly-resource="${'link' @ resourceType='my-project/components/link-large', decoration=true}" data-sly-unwrap="${true}"></div>
To understand more about data-sly-resource 7 data-sly-unwrap, please check below thread.
https://www.aemtutorial.info/p/htl-sly-unwrap.html
Regards,
Shiv
Views
Likes
Replies