Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to identify if URL contains editor.html in Sightly

Avatar

Avatar
Ignite 1
Level 1
saukaush
Level 1

Like

1 like

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Give Back
Boost 1
View profile

Avatar
Ignite 1
Level 1
saukaush
Level 1

Like

1 like

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Give Back
Boost 1
View profile
saukaush
Level 1

03-03-2021

I need to differentiate between below URLs in Sightly html.

http://localhost:4502/content/abc/xyz/test.html and

http://localhost:4502/editor.html/content/abc/xyz/test.html

 

How can I achieve the same? I tried using wcmmode.edit but it evaluates to true in both cases.

View Entire Topic

Avatar

Avatar
Give Back
Employee
Mariia_Lukianet
Employee

Likes

15 likes

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Give Back
Employee
Mariia_Lukianet
Employee

Likes

15 likes

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Mariia_Lukianet
Employee

03-03-2021

Your current WCM Mode doesn't depend on the presence of "/editor.html". It depends on "wcmmode=disabled" parameter.
For example, even http://localhost:4502/editor.html/content/abc/xyz/test.html?wcmmode=disabled will evaluate "wcmmode.edit" to false.

 

currentPage.path will not contain "/editor.html". I checked HTL global object, Java object will most likely return the same.

${currentPage.path}


If you can use JavaScript clientlib for your use case this will do the trick:

window.location.href.indexOf("/editor.html") > -1

 

[1] https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/global-objects.html?lang=en...