Mr Smith
Mr Smith

Reputation: 3486

Rules for Rich Text Field usage?

Can anyone point me to some rules to follow when using using Rich Text Fields on Tridion Components? I notice that you can enter mark up directly on the Source tab, but if you enter incomplete html then tridion completes it for you, as follows:

<!--Enter this-->
<td>test</td>


<!--And it becomes this-->
<table>
<tr>
<td>test</td>
</tr>
</table>

If you enter invalid markup, then you get a Validation Results popup telling you that your syntax is invalid:

<!--Generates Validation Results popup -->
<badtag>

It seems that there is no problem with adding attributes like id and class to the RTF html, as long as the HTML is valid, but what is everyone else's experience? Can anyone point me to some additional best practices for what I should and should not try & do in a Component RTF field?

Upvotes: 16

Views: 1040

Answers (2)

Bart Koopman
Bart Koopman

Reputation: 4835

Good question indeed, although not as easy to answer. I believe @Ram is right that there aren't any best practices written out there, guess most of it is passed on through the content modeling training (see the available training tracks) but I have to admit, that the answer to your question is not discussed in much detail there.

From experience I've seen that Rich Text fields are one of the most abused options in SDL Tridion. Things I would call typical abuse is for instance an Article Schema with a single Rich Text field, designed for editors to enter HTML directly onto the page. While that is clearly not the way to go for most people (I hope ;o), it does greatly depend on customers requirements how far one should go and what you should allow in Rich Text field usage.

The first discussion which always comes up is if you should allow formatting of content by editors at all. I'm always tempted to say content and layout should be separated, but you directly come into a conflict there with things like tables, emphasized text, lists and links. So that's where Rich text fields come into play.

I'm in favour of restricting the use of Rich text fields as much as possible always, so use the available XSLT to strip unwanted tags and (styling) attributes. One of the first things to consider are usage of images in a Rich Text field, and second on the list will be script and form tags. If you don't want to allow them in your Rich Text output, adjust the XSLT to remove them. But in the end it (unfortunately) mostly comes down to customer requirements. Although you do have a role in advising them on what does and what doesn't make sense of course.

Upvotes: 1

Ram G
Ram G

Reputation: 4829

Great Question. The best practices depend on client to client, at least based on my experience with Tridion.

I have seen some clients who are very comfortable and doing more in RTF fields (almost building everything like data capture forms -- jeeez..), and seen some clients who are not very comfortable with editor (e.g.; copy and paste from word doc etc..).

I have not seen a best practice document and I don't think one fits all as this depends on organization or agency skills and comfort.

As rule of thumb, XHTML complaint is a must and that's what Tridion RTF editor does(good thing). That is the reason why you noticed the cleanup of valid/invalid html format.

This below link from Alvin touches some of the topics, but may not be exactly what you are looking for.

http://www.tridiondeveloper.com/rich-text-format-area-css-classes-vs-custom-xml-nodes

If you find one, please do share with us. I am looking for one as well. :)

Upvotes: 11

Related Questions