Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

HTML5 tags are removed in component.

Avatar

Level 1

I'm working on a component to allow users to paste html into a text box and have the page render it as markup, but the html5 tags are getting removed. In the html for the component I'm setting the context to 'html' which does allow the non-html5 tags to render correctly. Does anyone know how I could modify this to allow the html5 tags?  I'm on AEM 6.1. Here it the code:    

<div data-sly-test="${wcmmode.edit}" data-sly-unwrap>

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

</div>

<div data-sly-test="${!wcmmode.edit}" data-sly-unwrap>

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

</div>

2 Replies

Avatar

Employee

Can you try one thing to see if this is an input or output problem.

Replace context = 'html' with context='unsafe'

Avatar

Level 1

Hi - All html tags are now showing up in inspector, but not all of the tags are working correctly. For example where I have a source set of images the page is defaulting to the fallback, <img> image.  Here's an example of the code:       <div class="hero__image">
        <picture>
          <source media="(min-width: 736px)" srcset="/content/dam/hrcms-r1/hero-large.jpg 1x, /content/dam/hrcms-r1/hero-large@2x.jpg 2x">
          <source srcset="/content/dam/hrcms-r1/hero.jpg 1x, /content/dam/hrcms-r1/hero@2x.jpg 2x">
          <img src="/content/dam/hrcms-r1/hero-large.jpg" alt="">
        </picture>
      </div>