data-sly-resource rendering a different htl template? | Community
Skip to main content
Level 6
February 15, 2023

data-sly-resource rendering a different htl template?

  • February 15, 2023
  • 2 replies
  • 1161 views

Hi

I would like to use data-sly-resource to render a HTL that is somewhat different then the existing one.

I tried using selectors='overview'

data-sly-resource="${event.resource @ resourceType='xxx/components/content/eventTeaser', selectors='overview'}">

and created a copy of eventTeaser called eventTeaser.overview.html.

The problem is that the new HTL template eventTeaser.overview.html is not called but instead the eventTeser.html is called.

 

Of course eventTeaser.overview.html exists and it is in the same directory as eventTeaser.html is.

 

What am I doing wrong here and what would be a good solution for this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Manu_Mathew_
Community Advisor
Community Advisor
February 15, 2023

@anasustic 

data-sly-resource="${event.resource @ resourceType='xxx/components/content/eventTeaser',appendPath='eventTeaser.html' addSelectors='overview'}">

I guess, you can try something like this. 

anasusticAuthor
Level 6
February 15, 2023

Hi,

thanks for writing.

I tried it exactly like your wrote but it is again using the eventTeaser.html and not the eventTeaser.overview.html.

Manu_Mathew_
Community Advisor
Community Advisor
February 16, 2023

@anasustic In that case you could try to create  "overview.html" instead of eventTeaser.overview.html and try this-

data-sly-resource="${event.resource @ resourceType='xxx/components/content/eventTeaser', addSelectors='overview'}">

  

nitesh_kumar-1
Adobe Employee
Adobe Employee
February 15, 2023

Hi @anasustic ,

 

In this case, you just need to create "overview.html".

 

This "eventTeaser.overview.html" would have worked if there was a folder "eventTeaser" and overview.html inside it.

 

Check your Sling's recent request to trace the request and get more information.

http://localhost:4502/system/console/requests 

 

Also, check this cheatsheet for sling resolution

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/sling-cheatsheet.html?lang=en 

 

Hope that helps!

Regards,

Nitesh

anasusticAuthor
Level 6
February 16, 2023

Thank you so very much @nitesh_kumar-1 for your answer and your suggestion about the tracing that the cheatsheet. Super valuable resources