Url shortening when using handlebar in AEM

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

06-02-2021

We are using handlebar in AEM. We are passing the AEM authored data as a context to the handlebar template. It works fine. In the AEM component dialog, we have a link field that has a path starting with /content/<appname>

.When I render this component with handlebar.hbs file, the link is not getting shortened, but when we put this component on the HTML page, Apache resource resolver configuration comes into the picture, and shortens the URL as per the URL mapping defined. I know we can use the resource resolver .map()  function map the shorten the URL in the data but I would like to know if there any other way we can fix to shortened the URLs while using the handlebar? 

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

Sanket_Kumbharkhane

Avatar

Sanket_Kumbharkhane

Sanket_Kumbharkhane

08-02-2021

Hi @karanmahi ,

 

It is advisable to use config  Apache sling resource resolve factory for field resource.resolver.mapping only for publish instance to test it like a live environment.

 

Thus, if you have this configuration in the Author or common config folder, move it to config. publish folder and link should start working on Author as it is.

 

Screenshot 2021-02-08 at 12.53.42 PM.png

 

I am sure, you do have also all the standard mappings/rules on dispatcher like to map a hostname to AEM sites, etc.