Sitefinity gives you a lot of power. One of the many tools at your disposal is the ability to enter HTML in Content Blocks (either inline on a page, or in the Content Block type that can be shared among multiple pages). A common gotcha with new applications, however, is how Sitefinity filters these. Content filters exist out of the box in Sitefinity to presumably do two things:
While both of these traits are admirable on paper, a lot of the time they can get in the way. In our normal Sitefinity development and design workflows, we already trust every user with backend access to not enter malicious scripting, etc. Therefore when we set up a new Sitefinity application, one of the first things we do is disable these content filters so that we can work unhindered.
Here’s an example of a Content Block’s HTML content getting changed on the fly in Sitefinity, due to the existing content filters. This scenario occurs both when attempting to edit content blocks on pages and when attempting to edit Content Blocks in Content > Content blocks.
These content filters can be frustrating if you don’t catch them or don’t know why they’re happening! Luckily they’re easy enough to disable.
Now that we’ve disabled the content filters, we can freely enter content in the Sitefinity backend without worrying about Sitefinity changing or deleting our work. As before, this applies both to content blocks on pages and to content blocks created as content items in Sitefinity proper.
The above content filter disabling practice only applies to the classic set of widgets and content. They do not apply to Sitefinity MVC Feather widgets. Feather content blocks have a separate means of filtering and formatting, which I addressed in a previous post of mine. But the content filters discussed here have no bearing on those.
Sitefinity has content filters in place to help preserve consistency and to help with security. In a lot of scenarios, these are redundant and can get in the way of content entry, design, or development. Sitefinity exposes these settings to allow for easy disabling of the content filters to allow you to go unhindered when entering content going forward.