Current Page in Sling dynamic include | Community
Skip to main content
New Participant
January 9, 2024

Current Page in Sling dynamic include

  • January 9, 2024
  • 3 replies
  • 1273 views

Hello , I am using the sling dynamic include for some of the resources, it's working in expected way. My question is can we get the current page  in sling dynamically included component  ?

 

Thanks in advance !!

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

3 replies

kautuk_sahni
Employee
January 11, 2024

@margaritageg Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
New Participant
February 20, 2024

I didn't get the answer. I had trouble using experience fragments directly as dynamic includes. So, I tried something else. Instead of using the whole experience fragment, I just took out the part I needed for the dynamic include. Now, I can control things better and get the results I want

TarunKumar
New Participant
January 10, 2024

Hi @margaritageg ,

Can you try checking with currentPage object?

Nitin_laad
New Participant
January 9, 2024

@margaritageg 

Have you checked this - 

${request.requestURL.toString}

Or

<sly data-sly-test.scheme="${request.scheme}"/>
<sly data-sly-test.servername="${request.serverName}"/>
<sly data-sly-test.serverport="${request.serverPort}"/>
<sly data-sly-test.val="${request.requestURI}"/>
${scheme}://${servername}:${serverport}${val}

 Ref - Apache Sling :: Apache Sling Dynamic Include

New Participant
January 9, 2024

Yes i have checked, it gets an experiance fragment's path 

narendragandhi
New Participant
January 9, 2024