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
BedrockMission!

Learn More

View all

Sign in to view all badges

Including/injecting experience fragment component directly within the sightly.

Avatar

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
kanishakar14249
Level 1

27-09-2018

I have a requirement where I need to include the content fragment OOTB component directly within the sightly and map it to respecitive fragments within the component. Something like below :

<div data-sly-resource="${'tabMap{0}' @ format=tabMapList.count ,resourceType='/libs/cq/experience-fragments/components/experiencefragment'}"></div>

Above implementation is required within the tab component, so needs to be added within the list(loop).

I am able to see any other foundation/custom component appearing on the page but unable to add the experience fragment.

Am I missing something any further configuration or step to achieve the same?

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

27-09-2018

Hi,

The correct location of component is /libs/cq/experience-fragments/editor/components/experiencefragment

But It is not working there also I can see errors in error.logs

TypeError: Cannot call method "get" of undefined (/libs/cq/experience-fragments/editor/components/experiencefragment/experiencefragment.js#22)

  at org.apache.sling.scripting.sightly.js.impl.loop.EventLoop.run(EventLoop.java:71)

  at org.apache.sling.scripting.sightly.js.impl.loop.EventLoop.schedule(EventLoop.java:46)

  at org.apache.sling.scripting.sightly.js.impl.JsEnvironment.runScript(JsEnvironment.java:106)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

27-09-2018

I agree with Arun - its not working. Only way i have used an Experience Fragment in an HTL component is when it has this line:

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

THen i drop the Experience Fragment into the HTL component.

ParSys.png

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

27-09-2018

This works --

ParSys1.png

Avatar

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
kanishakar14249
Level 1

27-09-2018

smacdonald2008 thanks for the response, but as I am using the experience fragment within the tab component, I need the multiple instances of the experience fragment. So wanted to avoid one step where an author has to include explicitly "experience fragment" component and later attach to the existing experience fragments.

As this is also a component, why we are unable to include it directly in the sightly.

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

27-09-2018

I tried to proxy component but no luck though working with template.

Avatar

Avatar
Validate 1
Level 2
prajwalreddy
Level 2

Likes

5 likes

Total Posts

31 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
prajwalreddy
Level 2

Likes

5 likes

Total Posts

31 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
prajwalreddy
Level 2

28-09-2018

If you have fixed list of the tabs in the component. May be you can try adding a cq:template node in the component with a number of nodes having sling:resourcetype property to the experience fragment component. This way the experience fragment node is created when you drag-drop your custom component and remove the error in you custom component.

1581252_pastedImage_0.png

We have done this in AEM 6.3 and worked fine. Let me know if you have any questions.

Avatar

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile
raj_mandalapu
MVP

28-09-2018

I think, the experience fragment will not work if it is not under the parsys node. you must dynamically find the parsys node and add child node as experience fragment node then it should work.

You need to write java code that finds out parsys and using addNode method add experience fragment node. then when you open tab component you will see experience fragment component.

Another approach is if the component is fixed on the template then you can add node hierarchy at template jcr:content node level.

Avatar

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
kanishakar14249
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
kanishakar14249
Level 1

28-09-2018

prajwalreddy , the no of tabs here is completely author driven and can be many as well. So I don't think this will work out.

Avatar

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile
raj_mandalapu
MVP

28-09-2018

kanishakar14249474,

If it is author driven then you will not have control on it,  you must write Java code, which finds par node and add experience fragment node as a child node, but think about tradeoff's