Trouble with HTL includes | Community
Skip to main content
May 17, 2017
Solved

Trouble with HTL includes

  • May 17, 2017
  • 4 replies
  • 2527 views

I have two includes on my sightly template (all files created by the Eclipse plugin):

<div data-sly-resource="${image @ resourceType='wcm/foundation/components/image', cssClassName='hero-img mdl-shadow--2dp'}" data-sly-unwrap></div>

This one renders some kind of default image:

<img src="/etc/designs/default/0.gif" title="Box" class="cq-dd-image" data-emptytext="Image">

The other is a text include: <div data-sly-resource="${text @ resourceType='wcm/foundation/components/text'}" data-sly-unwrap></div>

Renders this:

<p class="cq-text-placeholder-ipe" data-emptytext="Text"></p>

File I'm using is: apps/mysite/components/structure/page/partials/main.html

I can't figure out what I'm doing wrong. Why won't these open author dialogs?

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 leeasling

Remove the "data-sly-unwrap" - you're unwrapping the element that's needed for editing.  

4 replies

Adobe Employee
May 18, 2017

Hi Paul,

I am not quite clear with your question here.As far as I understand , you have got a page component in which you are including two resources one is text component and another is image.

But when you open the page , text component is showing up but it is not showing dialog box .

If I got your question right. Then it's a weird behaviour and only reason which I can think of is you might be in Preview mode.

smacdonald2008
Level 10
May 18, 2017

What version of AEM are you using?

leeaslingAccepted solution
Level 8
May 18, 2017

Remove the "data-sly-unwrap" - you're unwrapping the element that's needed for editing.  

May 19, 2017

You hit it on the head @leeasling

I removed the data-sly-unwrap and I put the predicate in single quotes.

So this is the result:

<div class="hero-img mdl-shadow--2dp" data-sly-resource="${'image' @ resourceType='wcm/foundation/components/image'}"></div>

<div data-sly-resource="${'text' @ resourceType='wcm/foundation/components/text'}"></div>

v6.2 BTW