May 3, 2020
Estimated Post Reading Time ~

Remove div tags in sightly

In JSPs it was possible to set “cq:noDecoration” and remove a div that would normally be generated by a component include (but also disable editing). You could also set the tag name to “”, without that particular negative side effect.

Yet another way was to change the IncludeOptions of the request.

But all those require JSPs. In Sightly it’s a bit different. The way you avoid extra divs is using “unwrap”

From the Sightly Doc:

UNWRAP
data-sly-unwrap": Removes the host element from the generated markup while retaining its content. This allows the exclusion of elements that are required as part of Sightly presentation logic but are not desired in the actual output.

However, this statement should be used sparingly. In general, it is better to keep the Sightly markup as close as possible to the intended output markup. In other words, when adding Sightly block statements, try as much as possible to simply annotate the existing HTML, without introducing new elements.”


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.