How to remove the wrapping div when using data-sly-resource? | Community
Skip to main content
Level 2
May 18, 2016
Solved

How to remove the wrapping div when using data-sly-resource?

Hi all,

currently we have a setup that includes a page using the following snippet:

<sly data-sly-resource="${item.path @ selectors='link', wcmmode='disabled'}"></sly>

this results in

<div class="base-page case-detail-page page">        <a href="">Name</a> </div>

Is there a way to remove the div and just keep the a href?

Much appreciated!

Regards

 

Mario

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Employee
May 18, 2016

Ok..., here comes a black-magic Sightly trick....

Use this (resourceType) in case you are referring to a page...

  1. <sly data-sly-resource="${item.path @ selectors='link', wcmmode='disabled', appendPath='jcr:content',  resourceType=item.contentResource.resourceType}"></sly>

 

Basically to remove the div you need to specify the resourceType...

11 replies

Level 9
May 18, 2016

Hi Mario,

Not pretty sure, but there is data-sly-unwrap[removes host element while retaining its content] available in sightly. 

Translate