Expand my Community achievements bar.

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

Avatar

Level 1

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?

1 Reply

Avatar

Level 1

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.