Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Link transformer config for Adobe campaign newsletter issue

Avatar

Level 2

The href <a href="tel:1800813327" target="_blank"> is rewritten

to 

<a href=\"https://www.mysite.comnull\" target=\"_blank\">

Adobe Campaign makes the following call to AEM to fetch content -

https://authordomain/content/campaigns/edm.campaign.content.json

The '.campaign.content.json ' selector servlet forms the html content from com.adobe.cq.mcm.campaign.impl.ContentgeneratorImpl class which uses link transformer config at /libs/mcm/config/rewriter/campaign-link-rewrite to rewrite links( surprisingly, it uses domain name in the exernalizer configuration; and not from sling mapping; should it not be using domain name from sling mappings?) and appends domain name in front of the link

Hence, the href 'tel' is not working ; similarly; mailto will also not work

We have removed 'A' from includeTags in the rewrite config as a quick fix; but it excludes all anchor tag from the config. What is the appropriate method of making the tel attribute work? Can certain attributes excluded from the rewriter config ? Or can the rewriter transformer config be overridden ?

Can someone please help on this?

25 Replies

Avatar

Administrator

Feike Visser  need your help here.



Kautuk Sahni

Avatar

Administrator

Try:

To add 'tel:' as a "Special Link Prefix" in the configuration of the CQ Link Checker Service.

To do this, copy /libs/cq/linkchecker/config/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl to a config folder under apps (e.g. /apps/myapp/config). Then edit the property service.special_link_prefix to add tel: as a new prefix.

Or Have a look at similar thread:-

~kautuk



Kautuk Sahni

Avatar

Level 2

H feike_visser,

I added x-cq-linkchecker=valid and x-cq-linkchecker=skip but it did not have any impact, the link it still being rewritten as

<a href=\"https://www.mysite.comnull\" target=\"_blank\">

Can it be because the link checker service is com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl while the rewrite transformer for the .campaign.content  selector is at com.adobe.cq.mcm.campaign.impl.LinkTransformer ?

I can't disable the entire link checker service as it will disable it for entire instance.

Also; have added 'tel:' as a "Special Link Prefix" in the configuration of the CQ Link Checker Service; but not sure if it is in play here.

Is there a configuration in link transformer config which can make it exclude specific hrefs? Like includeTags of html-parser which specfies which tags to include ?

Avatar

Level 10

As other members have pointed out - try to disable link checker.

Avatar

Level 2

Hi mjb54261515​,

If i disable link checker service altogether, it will disable it for entire instance which we do not want.

Avatar

Level 6

if it is Sightly try @context =‘uri’

<a href=“${properties.link @ context = 'uri'}"></a>

uri: For links and paths (in HTML, JS or CSS, applied by default for src and href attributes)

Reference: HTL Expression Language

please let me know how it goes.

Avatar

Level 2

Hi mjb54261515

Since this is text component, hence it is not possible to using 'uri' context in it; the context will always be text. The anchor tag provided is part of the markup entered in text component.

Avatar

Administrator

Not Tested but worth trying:- https://jeroendruwe.be/aem-allow-specials-link-prefixes/

//

Add the following xml file to a config folder under apps (e.g. /apps/myapp/config). in your project. com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" jcr:primaryType="sling:OsgiConfig" service.special_link_prefix="[javascript:,data:,mailto:,#,${,tel:]"/>

By now you should be able to see your new allowed list of prefixes under http://localhost:4502/system/console/configMgr > Day CQ Link Checker Service

Make it 'unsafe'

We need to disables escaping of are telephone number by doing the following:

href="${linkCtrl.link @ context='unsafe'}

More reference link:- Configuring Telephone Tags within Rich Text components and the Link Checker | 6D Labs

~kautuk



Kautuk Sahni

Avatar

Level 2

Hi kautuksahni

As mentioned in previous comment I have already tried it but did not work.

Avatar

Level 10

If you tried all the documented ways - and its not working - could be a bug. Consider opening a support ticket.

Avatar

Level 3

Hi,

We ran into the same issue on AEM 6.2 (with and without SP1, too).

We have the OSGi configurations from this thread already in place (xss configuration, link checker, etc.) and they fix it when getting the HTML on the publish instance or with wcmmode=disabled from the author instance.

However we also get the invalid links (like <a href=\"https://www.mysite.comnull\" target=\"_blank\">) when Adobe Campaign standard requests the HTML.

It can be reproduced by getting the HTML as http://.../myemail.campaign.content.json

Were you able to find the root cause?

Thanks,

Kornl

Avatar

Level 2

Hi kornel,

the root cause what we found is already mentioned in the question description - the rewrite config at

/libs/mcm/config/rewriter/campaign-link-rewrite

is rewriting all links , the temporary workaround is removing the 'A' tag from the config, but then, it stops rewriting all anchor links in the campaign, so we are still looking to find the proper solution  for this instead of removing the 'A' tag from the config which stops rewriting all anchor tags .

If you could find the solution, please let us know.

Thanks

Avatar

Level 2

Any further pointers on this?

How can we make "mailto:" work fine once its transformed from AEM to Campaign?

Avatar

Level 2

Adobe acknowledged it as product bug and will be releasing the fix in AEM 6.3 SP2

Avatar

Level 2

Thanks Deepankar. Could you please forward me the article/post that says so?

Avatar

Level 2

There is no publicly available article, the communication for this happened over daycare portal.