How to prevent AEM from deleting ${profile.expression} in code. | Community
Skip to main content
Level 2
March 11, 2024
Question

How to prevent AEM from deleting ${profile.expression} in code.

  • March 11, 2024
  • 1 reply
  • 513 views

We are using an expression ${profile.name}  in a <p> in the code of a page component that gets populated by another team when it's published to them that AEM is removing from the code.

I'm guessing AEM sees it as a property type which is why it isn't keep in the code.

Is there a <sly> or some other way to prevent AEM from removing that expression on publish by reading that ${expression} as a string?

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

1 reply

Level 4
March 19, 2024

Hi @kylemd,

 

You can try below code to prevent AEM from removing that expression.

<sly data-sly-test.profileName="${profile.name}"> <p>${profileName}</p> </sly>

 

To prevent AEM from removing the expression and treating it as a string literal, you can use the sly block to wrap it. By using the sly block with the data-sly-test attribute, you ensure that AEM doesn't remove expression from the code during publishing.