Getting the hostname using Sightly

Avatar

Avatar

junc70220741

Avatar

junc70220741

junc70220741

15-10-2015

Hello

Is it possible to get the hostname of the current page? 

currentPage.getPath() only returns something like '/path/path/page' but I also need to find the hostname, for example, 'https://www.google.com'

Is it possible? Or is there a good way of doing it?

View Entire Topic

Avatar

Avatar

Bruce_Lefebvre

Employee

Avatar

Bruce_Lefebvre

Employee

Bruce_Lefebvre
Employee

15-10-2015

Yes, it's possible. Check out the Externalizer service [0] for access to the hostname, and the Sightly Use-API [1] for exposing that value to your Sightly scripts.

[0] https://docs.adobe.com/docs/en/aem/6-1/develop/platform/externalizer.html

[1] http://docs.adobe.com/docs/en/aem/6-1/develop/sightly/use-api-in-java.html