When moving content from an existing CMS into Tridion, I have run across <style>
blocks in the RTF fields which the Tridion RTF strips out. Is there a way to prevent this?
2 Answers
Since <style>
elements are officially not allowed in an HTML body element, I think the TcmXhtml.Config
isn't going to help you (as you confirmed by trying already).
So the best solution I can give you (it will mean extra work) is to see if you can split the RTF content up in two parts for the migration:
Strip out the
<style>
tags (by means of XSLT for example) and add the remainder in the RTF field.Copy the contents of the
<style>
tag(s) to a separate field in the Component (plain text field) and in your Template you can decide whether to place it back in an (illegal ;o)<style>
tag in the body of your HTML, or if you move it up to the head or even in a CSS file (the latter is best but will probably be most work).
As nuno answered it here : https://stackoverflow.com/questions/9613598/how-to-add-custom-tags-to-rich-text-field-in-sdl-tridion
There is a file named TcmXhtml.Config under [Tridion]\web\WebUI\Core\Controls\FormatArea\TcmXhtml, where the rtf supported tags are defined. please check if your tag is there and if not present add it.
-
I'm thinking <style> must be a special case because it's a default hidden element, and so doesn't fit into the definition of block, inline, or empty. I tried adding it to all three but that didn't work.– TravisApr 13, 2015 at 14:33
<style>p {text-decoration:underline;}</style>
in your RTF, so it ends up in the body of your HTML?<style scoped>
, but I don't think that will work here either. You should really consider using inline styling on your elements (or beter use classes and add them in a CSS, rather than a style block)