How to change what Kupu and Plone filter out from a page
Changing what Kupu and Plone filter out by default
Let's say you want to add some custom HTML tags or maybe some Javascript to the front page of your site. When you try to do this through Kupu, when you save the page you notice that what you thought you had added was not actually added. This is because either Kupu or portal_transforms has filtered out what may be "unsafe" code.
HTML Filtering
You should go to Site Setup, look for the Kupu configlet, and in there you can change what it filters out. It's usually not a good idea to mess with the filtering because as you can imagine it helps prevent
- malicious code
- malicious aesthetics
It's the same filtering that prevents you from putting Javascript into the body of a page.
The other place to look is in the ZMI -> portal_transforms -> safe_html. Again, be careful what you turn off, because you will be leaving your site more vulnerable to exploit code inserted into its content.
Customized Template and Content Type
It is better to add your code to a custom view template used by a custom content type as its default view:
- create a "Custom_Page" content type (cloned from the normal Document or Page type).
- create a new template for the view of that new content type by customizing document_view in portal_skins then renaming it to something like "custom_page_view_template"
- add your new code to the new template by modifying what is inside its <body> tag
- change the new content type's default view to use the customized template you just created.
This way you are not disabling any filtering but can do what you need to for exactly the custom page.
Ledwell note: Be aware that if you go this route (creating a custom content type and template) that you do NOT use Kupu on that new page to add the custom code (ie.. the HTML toggle button). You'll want to add the custom code to the template in the portal_skins -> custom folder.











