Hi All,
Could you please help me with this issue? I am using AEM 6.5.20 and have an RTE/Text component in my project. I'm trying to author it in the dialog as follows:
After submitting the dialog, the value is being stored in the node as follows:
<p>Test Test <a href="%3C%= rt.ctx.logo%20%>">Test</a></p>
However, when I reopen the dialog, the content appears incorrectly (as shown in the screenshot), and I’m unable to identify where exactly I had authored the hyperlink.
Also, is it possible to save the value in the node as <%= rt.ctx.logo %>?
Thanks in Advance,
Veera
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @veerareddyc1015,
I had faced a similar issue a while ago: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/rte-link/td-p/451393
To answer your question:
<%= rt.ctx.logo %>
as-is in the node?No, not directly using the standard RTE. AEM RTE escapes special characters (like <
, %
, =
) automatically. You would need to override or post-process this behavior to retain raw dynamic content.
Instead of using real <%= ... %>
expressions, use a custom token format (e.g., @@logo@@
) that is:
RTE-safe
Easy to detect and replace at runtime
<a href="@@logo@@">Test</a>
Then, in your HTL or backend code, replace @@logo@@
with rt.ctx.logo
.
<a href="@@logo@@">Click here</a>
String content = contentFromRTE.replace("@@logo@@", rt.getCtx().getLogo());
Separate static vs dynamic content:
Use RTE for authoring normal content
Use a hidden field or custom path field in the dialog to enter the dynamic expression like <%= rt.ctx.logo %>
Inject it in your HTL logic or rendering script
Not easily — RTE is designed to protect against XSS and malformed HTML, so it auto-encodes unsafe input. Disabling it entirely is risky and not recommended.
Hi @veerareddyc1015,
I had faced a similar issue a while ago: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/rte-link/td-p/451393
To answer your question:
<%= rt.ctx.logo %>
as-is in the node?No, not directly using the standard RTE. AEM RTE escapes special characters (like <
, %
, =
) automatically. You would need to override or post-process this behavior to retain raw dynamic content.
Instead of using real <%= ... %>
expressions, use a custom token format (e.g., @@logo@@
) that is:
RTE-safe
Easy to detect and replace at runtime
<a href="@@logo@@">Test</a>
Then, in your HTL or backend code, replace @@logo@@
with rt.ctx.logo
.
<a href="@@logo@@">Click here</a>
String content = contentFromRTE.replace("@@logo@@", rt.getCtx().getLogo());
Separate static vs dynamic content:
Use RTE for authoring normal content
Use a hidden field or custom path field in the dialog to enter the dynamic expression like <%= rt.ctx.logo %>
Inject it in your HTL logic or rendering script
Not easily — RTE is designed to protect against XSS and malformed HTML, so it auto-encodes unsafe input. Disabling it entirely is risky and not recommended.
Views
Likes
Replies
Views
Likes
Replies