How to add scriptlet expression <%= %> inside anchor tag | Community
Skip to main content
Level 2
June 4, 2019

How to add scriptlet expression <%= %> inside anchor tag

  • June 4, 2019
  • 2 replies
  • 12114 views

Hi,

I have a use case where I need to create an anchor tag as below -

<a href="<%= target %>">Click Here</a>

AEM is not accepting this syntax and removing href itself. (I have tried all options in Link checker service and transformer)

I tested this in a non AEM html page and it work fine and did not get removed. How we can make AEM understand this as valid link and avoid removal of href values?

Little background why I need this - We are creating Email templates in AEM and that would be used in Adobe Campaign Standard (ACS) as email delivery.

I have to use this scriptlet expression in href because ACS "Content Block" (file where I can fetch dynamic values per user) only understands this expression and I need to populate dynamic values when emails are getting prepared in ACS.

Thanks for any help on this!

Thanks,

Ratna

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

2 replies

joerghoh
Adobe Employee
Adobe Employee
June 5, 2019

What you can do is to disable link-checking for this particular link. Can you check if [1] helps?

[1] Disable the AEM Link Checker

Level 2
June 5, 2019

Hi Joerg,

Thanks for your reply!

Yes I tried that option but as soon as you put < or > signs as part of href value it remove the href attribute itself.

Even I tried other options like

- "Day CQ Link Checker Service" option "Special Link Prefix" by adding new entry for "<%" but that also didn't worked

- "Day CQ Link Checker Transformer" option "Rewrite element" by removing the default entry a:href, this also didn't worked

It appears HTL not accepting < or > signs as part of href.

Any other suggestions ?

Regards,

Ratna

Peter_Puzanovs
Community Advisor
Community Advisor
June 6, 2019

Hi Ratna,

Just to enchance on Joerg correct reply there is another KB that explains it just a bit more, How to disable Link Checker or configure to mark links as valid in AEM KB is your source of truth for this issue.

You can force AEM to ignore your element by adding:

<a x-cq-linkchecker="skip" href="<%= target %>">Click Here</a>

Where x-cq-linkchecker="skip" would notify Link Checker to ignore this particular element all together.

Regards,

Peter

Level 2
November 8, 2019

Hi,

Not sure if you already solved it or not but try something like &lt;%= target %&gt; , it should work.