Double Placeholder issue when including a component

Avatar

Avatar

ignacio_mancill

Avatar

ignacio_mancill

ignacio_mancill

02-08-2018

I have included a component inside another one with data-sly-resource and when included component is empty it shows two placeholders, the component placeholder and it also is taking the parent placeholder.

This is where component is being injected

<div>

<a href="${properties.url}">${properties.url}</a>

<span data-sly-resource="${'beforetitle' @ resourceType='project-test/components/content/title'}"></span>

</div>

This is the injected component

<div class="test-class"

     data-sly-use.title="com.adobe.cq.wcm.core.components.models.Title"

     data-sly-use.template="core/wcm/components/commons/v1/templates.html"

     data-sly-test.text="${properties.jcr:title}">

    <h1 class="test-class__text" data-sly-element="${title.type}">${text}</h1>

</div>

<sly data-sly-call="${template.placeholder @ isEmpty=!text, classAppend='test-class'}"></sly>

when you put the button component in a responsive grid or parsys the properties.jcr:title is null and it shows the placeholder but is taking the parent component as shown here below

1541019_pastedImage_1.png

Do you knoiw if this is actually an issue or there is an approach on how to resolve this?

Regards.

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

Veena_Vikram
MVP

03-08-2018

What is your exact requirement ? Are you trying to bring a title and link ? Can't you have single component with all your authoring fields ?

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

857

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

857
Arun_Patidar
MVP

03-08-2018

Hi,

why did you created title.html for project-test/components/content/title?

if you need to create title component, create a proxy component e.g. project-test/components/content/title using core components.

Using Core Components