I'm working on making the editing experience better for our users by trying to simplify the process of adding "special" components into a body of HTML text.

We publish news articles and many times our users place HTML tables, images, galleries, etc. within the article. Right now they're just using (very) limited HTML and CSS knowledge to drop these items in. I've started down the road of having the users simply drop in placeholder tags within the copy and then I'm going to dynamically replace them with the appropriate code. I was wondering if there was some known methodology of doing so, maybe something that Sitecore has figured out.

  • Do you want to create HTML tables in the UI editor without the editor having to know how to? I may suggest you go down the road of structured data and templates rather than trying to accomplish this in the UI editor. – Chris Auer Feb 17 '17 at 21:58
  • Have you thought about implementing some sort of shortcodes solution: sitecorejunkie.com/2013/09/07/… I've implemented this in the past and it works well. – Owen Niblock Feb 18 '17 at 10:23
  • @dnstommy No, that would make it more difficult I think. I agree using some structured data source could be ideal for those situations. – Kevin Feb 18 '17 at 22:38
  • @OwenNiblock Shortcodes look neat. I'm not sure if that will work for everything I have planned, but it might work well for other things. – Kevin Feb 18 '17 at 22:40

HTML Snippets might help you a bit, here.

HTML Snippets are defined in the Core database at this location

/sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Snippets

You should see a snippet already in there called "Sample Snippet".

The assign options may not be set in which case you can either duplicate the sample item that's there and update the values in the fields or set the insert options to the appropriate template which is

/sitecore/templates/System/Html Editor Profiles/Html Editor Snippet

In addition, you'll need to make sure your rich-text fields are using a profile that shows the Insert Code Snippet button.

I recommend updating the HtmlEditor.DefaultProfile setting with a patch config and set it's value to

/sitecore/system/Settings/Html Editor Profiles/Rich Text Full

so that all rich-text fields display the full set of controls.

Here's an example of a patch config to make this setting change

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <setting name="HtmlEditor.DefaultProfile">
        <patch:attribute name="value" value="/sitecore/system/Settings/Html Editor Profiles/Rich Text Full" />
  • I did consider code snippits, but I have an ulterior motive behind my question. Those big charts typically don't render well on mobile. So when on mobile I plan to render a link to download a PDF version of the chart. I have software that will convert the HTML & CSS into a PDF. – Kevin Feb 18 '17 at 22:36

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.