03Oct, 2024
The Coming of Sitecore 10.1 Means It's Necessary to Move HTML Content From the Multi-Line Text Field to Rich Text Field Type
Another change the team has found recently was the ability to place HTML content in fields has been updated. Though it was never meant to contain HTML, the Multi-line text field allowed it, and even though this is poor practice, at times our hands are forced.
Why Allow HTML?
First things first. This practice goes against my best judgement, but when a client hears my advice and reasons for not allowing HTML in a CMS, it's their decision and risk at the end. If I put my foot down and say no, they'll just get another team to do it.
Why Mutli-Line Text?
This field type allowed for plain text to be added with no Rich Text Editor getting in the way. It was a reliable method to save whatever JavaScript or HTML the client wanted. So far, I've only allowed this for Administrators to author, and meant for simple tracking scripts, etc.
What Changed and How to Move On?
According to Sitecore, the Muti-line Text field should have never allowed HTML content, which they corrected in Sitecore 10.1.
The easiest way to do this now, is change the field types to Rich Text, and patch Sitecore (don't edit Sitecore.config), so HtmlEditor.RemoveScripts is disabled.
This idn't the best interface, since the RTE can mess with HTML formatting, but it's the easiest for what's hopefully a rare case.