Skip to main content
Level 2
September 5, 2023
Solved

Experince Fragment Export as Javascript Module

Hi All,

We have requirement where we need to export XF as Js so that it will be use another NON-AEM to fetch the content.

Example:

http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js 

it will display whole content of XF  and same we will refer to the other NON-AEM

 

is anyone worked on such type of requirement

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Sanjay_Bangar
Sanjay_BangarAccepted solution
Community Advisor
September 7, 2023

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay 

 

4 replies

Sady_Rifat
Community Advisor
Community Advisor
September 5, 2023

Hello @test566,

You can check this article, where it will meet your requirements: https://exadel.com/news/aem-experience-fragments-consuming-outside-aem/ 

From the external source, you can add it via,

<div>External Content</div> <script src="http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js"</script> </div>

 

Translate
test566Author
Level 2
September 5, 2023

Hi @sady_rifat ,

Currently I am following the same but its giving error so that what i asked here if someone already implemented .

Thanks

Translate
Sady_Rifat
Community Advisor
Community Advisor
September 5, 2023

Then if possible, please share the error, it will be more helpful to solve it.

Translate
Sanjay_Bangar
Community Advisor
Sanjay_BangarCommunity AdvisorAccepted solution
Community Advisor
September 7, 2023

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay 

 

Translate