Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Insert text field component in HTML

Avatar

Level 2

I created a component that uses text fields, but adding them gives me <p> tags, for example

Jeremy98_0-1668736870756.pngJeremy98_1-1668736891297.png

Can someone help me to get the text right?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Jeremy98 Use @ context='html'in your HTL

eg.

 ${model.text @ context='html'}

 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @Jeremy98 ,

I am assuming that you are referring to those <p> which are generated when you type something in RTE and view source edit.

The default behaviour of AEM generates those <p> tags and can only be removed if you author only one paragraph by adding property removeSingleParagraphContainer

For more details please refer this article [0].

[0]: https://sourcedcode.com/blog/aem/aem-richtext-remove-p-tag-removesingleparagraphcontainer-for-touch-...

Hope that helps!

Regards,

Santosh

Avatar

Level 2

Now it stay like this

Jeremy98_0-1668738924872.png

i need only show the text, in this case "descrption", not "<p>description</p>

Avatar

Correct answer by
Community Advisor

@Jeremy98 Use @ context='html'in your HTL

eg.

 ${model.text @ context='html'}