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 add scriptlet expression <%= %> inside anchor tag

Avatar

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

04-06-2019

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

Replies

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

05-06-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

Avatar

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

05-06-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

Avatar

Avatar
Validate 25
MVP
PuzanovsP
MVP

Likes

140 likes

Total Posts

543 posts

Correct Reply

165 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 10
View profile

Avatar
Validate 25
MVP
PuzanovsP
MVP

Likes

140 likes

Total Posts

543 posts

Correct Reply

165 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 10
View profile
PuzanovsP
MVP

06-06-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

Avatar

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

Avatar
Validate 1
Level 1
ratnaa93805121
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

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

06-06-2019

Hi Peter,

Thanks for your response!

I tried that too but it didn't worked and with this enforcement also it removes the href attribute.

Just add and to clarify that, this happens when I try creating an anchor link either using RTE or Content Fragment. For example use the this syntax "<a x-cq-linkchecker="skip" href="<%= target %>">Click Here</a>" in RTE as HTML source and it will show you as link, but the moment you save the changes in RTE and come out, it removes the href from anchor tag. Same is the case with Content Fragment.

When I use this same syntax directly on component html file it work fine, but that wont solve my purpose as my authors would need this ability to use this syntax to create any link during authoring.

Regards,

Ratna

Avatar

Avatar
Give Back 3
Level 2
navjots41427941
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

1 solution
Top badges earned
Give Back 3
Give Back
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Give Back 3
Level 2
navjots41427941
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

1 solution
Top badges earned
Give Back 3
Give Back
Boost 3
Boost 1
Affirm 1
View profile
navjots41427941
Level 2

08-11-2019

Hi,

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