I am using Rich Text Editor for the template field for script content, I need to make the entire script editable in Sitecore SXA 10. The RTE removes the script content.

The script content is as follows:

<script type="text/javascript" src="https://cdn.cookielaw.org/consent/{{ID}}-test/OtAutoBlock.js" >

<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"  type="text/javascript" charset="UTF-8" data-domain-script="{{ID}}-test" >

<script type="text/javascript">
  function OptanonWrapper() { }

Are there any alternative ways in Sitecore to consider the script content the way it is?

2 Answers 2


Very short answer, but with a Rich Text field this will not work (you can tweak the RTE to allow all kinds of tags but you really don't want to do that for scripts).

Try using a Multiline Text field. That should do it.

  • I tried using the Multiline text field but it doesn't work very well. Commented Jun 13, 2022 at 15:02
  • What is not working? Can you edit your question and clarify because you were mentioning the RTE...
    – Gatogordo
    Commented Jun 13, 2022 at 16:00
  • Sorry @Gatogordo my bad. Thank you for your response. This helps. Commented Jun 14, 2022 at 5:25

Generally, if you want to render custom scripts like this, then you can prefer the OOTB control in SXA to do this, called Plain HTML or Plain HTML (Reusable)

enter image description here

When you select this in Experience editor and click on Edit HTML button, it will open this in content editor mode and you will be able to add your custom HTML of JS in the field that is the type of Multiline Text Field as @Gatogordo mentioned in his answer.

enter image description here

And the HTML or JS will get rendered on your page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.