내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

HOW TO INCLUDE ONE COMPONENT WITHIN ANOTHER COMPONENT?

Avatar

Level 2

I need some help in including a component inside another component.

This is the scenario:
1. I have a page-hero component
2. I have a request info component

Now I want to add this request-info component in the exact middle of page-hero.

Can anyone please help me out with the steps that I have to follow in order to achieve this.
Note: I am very new to AEM and have been using it since the past 6-7 months.

@kautuk_sahni @BrianKasingli @arunpatidar @DEBAL_DAS 

Thanks in advance!!

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @ac6600 ,

You can use data-sly-resource 

data-sly-resource includes the result of rendering the indicated resource through the sling resolution and rendering process.

eg.

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

where "wcm/foundation/components/responsivegrid" is path to your component.

Hope that helps!

Regards,

Santosh


Santosh Sai

AEM BlogsLinkedIn


원본 게시물의 솔루션 보기

3 답변 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @ac6600 ,

You can use data-sly-resource 

data-sly-resource includes the result of rendering the indicated resource through the sling resolution and rendering process.

eg.

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

where "wcm/foundation/components/responsivegrid" is path to your component.

Hope that helps!

Regards,

Santosh


Santosh Sai

AEM BlogsLinkedIn


Avatar

Employee Advisor

Let's suppose I want to include image component inside hero-image component then I will use below htl code to include image component -

 

<sly data-sly-resource="${'image' @ resourceType='weretail/components/content/image'}"></sly>

Avatar

Community Advisor

@ac6600 

data-sly-resource includes the result of rendering the indicated resource through the sling resolution and rendering process. It helps include result of a resource from a path specified. The sling resolution and rendering process will process the indicated resource from path and result will be included.

In your case you just have to use - 

<sly data-sly-resource="${'requestInfo' @ resourceType='path of request info component'}"></sly>

within the html of your page-hero component.

 

for more details fon HTLs:

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/block-statements.html?lang=...