Dear Team,
Is there any way we can print exact browser URL in Sightly HTML?
e.g.
1) if Page url is http://localhost:4502/editor.html/content/home.html
It should print exact same i.e. http://localhost:4502/editor.html/content/home.html
2) If Page url is http://localhost:4502/content/home.html
It should print exactly same i,e http://localhost:4502/content/home.html.
Note: I tried with ${request.requestURL.toString} but in both the cases it prints only
http://localhost:4502/content/home.html. . It ignores editor.html.
Thank you in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @arvind,
This is normal for a typical AEM Author instance installation. The reason is that the WCMMODE is EDIT by default on Author instances, which is mentioned in the documentation here: https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...
In order to simulate a Publisher instance, you must add ?wcmmode=disabled to the URL, regardless of whether /editor.html is present in the URL or not (this is what the View as Published option does).
I demonstrate this in the GIF below:
If it is not utmost important to use sightly particularly, you can leverage JS(
window.location.href
) and jquery to get the URL and then append it html tag where you want it.
If you want to use sightly only then I guess you are able to get the full URL except "editor.html".
In this case you can form your URL add "editor.html" in URL if the user is in Edit mode [wcmmode.edit].
@Varun_Shakya , Thank you for your reply.
Actually my req is to add some class in a div only when we are in edit mode i.e. when url contains editor.html.
I already tried wcmmode.edit but unfortunately it always gives me true whether I hit http://localhost:4502/editor.html/content/home.html or http://localhost:4502/content/home.html.
Regards,
AP
refer this
Check for Arun's comment
<sly data-sly-test.editor="${wcmmode.edit || wcmmode.design}"></sly>
<div id="mydivid" class="${editor?'abcd xyz myclass':'abcd xyz'}">
........
</div>
Views
Replies
Total Likes
Hi @arvind,
This is normal for a typical AEM Author instance installation. The reason is that the WCMMODE is EDIT by default on Author instances, which is mentioned in the documentation here: https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...
In order to simulate a Publisher instance, you must add ?wcmmode=disabled to the URL, regardless of whether /editor.html is present in the URL or not (this is what the View as Published option does).
I demonstrate this in the GIF below: