Browser URL in Sightly

Avatar

Avatar

arvind

Avatar

arvind

arvind

02-09-2020

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.

View Entire Topic

Avatar

Avatar

Varun_Shakya

MVP

Avatar

Varun_Shakya

MVP

Varun_Shakya
MVP

02-09-2020

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].