5

We have just started working with SDL Tridion 2011 and we are creating DWT Templates containing our HTML parts of web pages. The issue that we are facing is that, we have few html tags where we are using custom attributes: For Example:

<a href="someurl.com" data-info="someinfo" data-category="someinfo"></a>

The problem is that, when we add the lines like above in an RTF field and try to save the component, all custom attributes gets disappeared, so the above line becomes:

<a href="someurl.com"></a>

Are we missing something?

6

Welcome to the world of Tridion and the site.

Follow below steps to resolve this issue:

  1. On your CMS server, navigate to the following path: ..\TridionWeb\WebUI\Core\Controls\FormatArea\TcmXhtml

  2. Open the configuration file named - TcmXHTML

  3. In this configuration file locate the tag having name something like - drop-proprietary-attributes (expect some spelling mistake as I currently not have access to CMS Server but it will looks like it)

  4. Toggle the value of this tag from true to false

  5. Restart the SDL Tridion Content Manager DCOM+ Application and reload the CME

This should resolve the issue.

  • Thank you so much for your prompt response. This resolves the issue. – user427 Apr 13 '13 at 6:29
  • This works, but I'd be careful with calling this an issue which implies it's a problem to be fixed. What's also missing is context and the fact that the rich text format area setting is meant to be XML in the XHTML namespace (citing Dominic Cronin). I'll add some "gotchas" in a separate answer. – Alvin Reyes Apr 13 '13 at 7:29
  • I have not put up my mind at all here. We had the same issue and we received this solution from Experts from SDL Tridion Support. I think we should have give this knowledge to those guys as well. – Pankaj Gaur Apr 13 '13 at 8:04
  • Fair enough, yes it's good to know how to change the allowed settings. I think context also helps, especially when the question comes from someone possibly new to the software. If you've been okay with the data- attributes for around a year, I'd be interested in how it worked for users and implementation. – Alvin Reyes Apr 13 '13 at 9:17
6

"Are we missing something?"

The rich text format area is meant for rich text that matches XHTML or a subset based on schema field settings. To add those attributes consider instead:

  • Making the link a separate component which has fields for url, data-info, and data-category.
  • CSS styles that you transform during publish (in template logic), with server-side code, or client-side script (see approaches in the links below)

Either approach will save authors the challenge of entering these into source and prevent implementation problems if SDL changes how RTF's work. Independent components for your links can also let you configure options, add more fields as needed, and easily change the attributes with a template update and publish.

For background, Nickoli Roussakov provides a how-to guide, I suggest more independent formats, and Nuno Linhares makes the stronger warning in this SO answer.

  • Any idea, why then SDL Tridion has provided those configurations; and why the SDL Tridion support provides this as a solution to us around a year back? – Pankaj Gaur Apr 13 '13 at 8:05
  • 1
    Maybe because you knew what you're doing? :-) Note I'm not saying it's "un-supported," but Support having someone do something in a ticket doesn't necessarily mean it's the best approach for everyone. For example, Support may have one customer run a database query or specific hotfix, but it might not apply for everyone else. From the community, in terms of custom XML in rich text fields, you'll hear HTML5 is okay-ish. But not much love for random XML. – Alvin Reyes Apr 13 '13 at 9:03
  • 2
    Support answered your question: "how can I prevent these custom attributes from being dropped?" The question that Alvin (and Nuno in his blog post) raise is on another level: "is it a good idea to use custom attributes?" That latter question falls outside of the reach of product support. – Frank van Puffelen Apr 14 '13 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.