Level 1
Level 2
Sign in to Community
Learn more
Sign in to view all badges
Expand my Community achievements bar.
This conversation has been locked due to inactivity. Please create a new post.
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 url (/content/my-site/currentPage.html) in sling dynamically included component ?
Thanks in advance !!
Try using this:
${request.requestURL.toString} --> the best way
or just composing it:
<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}
Not able to use slingRequest.getURL() in sightly
Thank you Hemant for your response.
We do not get the request URI in sling dynamic include, so .toString() is not working there.
In java for SlingHttpServletRequest request
final RequestPathInfo pathInfo = request.getRequestPathInfo(); final String resourcePath = pathInfo.getResourcePath();
or
final String resourcePath = request.getResource().getPath()
Views
Likes
Replies