Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Trouble with HTL includes

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Level 8

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

View solution in original post

4 Replies

Avatar

Employee

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.

Avatar

Correct answer by
Level 8

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

Avatar

Level 1

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