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

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

  • May 18, 2016
  • 11 replies
  • 9177 views

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.
Best answer by Feike_Visser1

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

New Participant
May 18, 2016

Hi Mario,

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