Url shortening when using handlebar in AEM | Community
Skip to main content
Level 4
February 6, 2021
Question

Url shortening when using handlebar in AEM

  • February 6, 2021
  • 1 reply
  • 1283 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Sanket_Kumbharkhane
Level 4
February 8, 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.

 

 

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

karanmahiAuthor
Level 4
February 8, 2021
This is not what i asked in my question. My question is about how to shorten the url in handlebar .hbs file