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

Current Page in Sling dynamic include

  • January 9, 2024
  • 3 replies
  • 1280 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

Nitin_laad
Community Advisor
Community Advisor
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

Level 2
January 9, 2024

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

narendragandhi
Community Advisor
Community Advisor
January 9, 2024
TarunKumar
Community Advisor
Community Advisor
January 10, 2024

Hi @margaritageg ,

Can you try checking with currentPage object?

kautuk_sahni
Community Manager
Community Manager
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
Level 2
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