My HTML is Changing!
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:
- Standardize content entry (i.e. transform all <i> tags to <em> tags)
- Security precaution (i.e. strip out <script> tags)
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.
- Hop on over to Administration > Settings, click Advanced, then Appearance. Within your site, you can go directly to this screen by visiting http://www.example.com/Sitefinity/Administration/Settings/Advanced/Appearance.
- Here you will find three settings: RadEditor filters for Content block widget, Rad Editor’s content filters, and Rad Editor strip formatting options.
- Change all of these settings to “None” (without the quotes).
- Click “Save changes.”
Content Entry Unfiltered
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.
Content Filters and Sitefinity Feather
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.
Latest posts by Falafel Posts (see all)
- Matching Complex Query String Rewrite Rule in IIS - March 22, 2017
- Disable Content Filters in Sitefinity - March 8, 2017
- On Sitefinity Custom Widget Caching - February 22, 2017
- Dynamic Content Detail Widget Templates in Sitefinity - February 8, 2017
- Using Google Services in UWP C# Apps – Part 2 - February 7, 2017