synthetic resource creation | Community
Skip to main content
sreenu539
Level 7
October 6, 2022
Solved

synthetic resource creation

  • October 6, 2022
  • 2 replies
  • 1794 views

Hi,

 

I am looking to create dummy resource with a resourceType (text), valuemap properties and not to create any real jcr data/nodes.

 

In sightly html get the dummy resource using "data-sly-resource" tag and render it.

 

Thanks for all the help.

 

Usecase: retrieve content fragments elements and have it as accordion item panel title, child text component.

 

Thanks,

Sri

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 Kishore_Kumar_

Hi @sreenu539 ,

 

Yes we can use it via Sling. Sling model can be used to define such resource and its appropriate properties and it can be used by HTL for rendering.

 

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/org/apache/sling/api/resource/SyntheticResource.html 

2 replies

B_Sravan
Community Advisor
Community Advisor
October 8, 2022

Hi @sreenu539 ,

 

In order to use "data-sly-resource", it requires a physical location of the node.

But you can achieve this in a different way using AemContext api.

 

for the mentioned use case, why can't you simple get the resource of your content fragment an iterate through the configured properties?

 

Kishore_Kumar_
Kishore_Kumar_Accepted solution
Level 9
October 9, 2022

Hi @sreenu539 ,

 

Yes we can use it via Sling. Sling model can be used to define such resource and its appropriate properties and it can be used by HTL for rendering.

 

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/org/apache/sling/api/resource/SyntheticResource.html 

sreenu539
sreenu539Author
Level 7
October 10, 2022

Does this create an actual resource ?

Kishore_Kumar_
Level 9
October 16, 2022

no, its synthetic. it wont create any node under content.