“MySpace” the Content Editor – Customizing the Content Editor via the Rules Engine – Part 3: File Mapping

myspace-jpg-large

Let’s pretend I inherited a very old Sitecore implementation that was developed in the dark ages back in 2010 using Sitecore version 6.4.  Before version 7 and the renaissance, the history books tell us that this period was very dangerous, the Page Editor was largely ignored, template and field proliferation was widespread and anarchy reigned supreme.

Early in development on this site, a “Content Block” template was created. It was basic, it had three fields: Title, Summary and Link.  As things progressed, requirements changed and features added, a developer missed that perfect time to split this component up and this poor “Content Block” ended up with 14 fields.

Template: Content Block
Section: Content
Fields: Title, Subtitle, Summary, Abstract, Footnote, Link, Link2
Section: Media
Fields: Image, Icon, Video, Video Placeholder Image
Section: Settings
Fields: Background Color, Image Position, Container Css Class

Today, we all encourage content authors to use the Experience Editor.  Luckily for this site, the Experience Editor helps hide the ugliness of the “Content Block”.  However, the content author working on this site prefers the Content Editor.  The content author’s current task is editing a “Content Block”.  The page that this component appears on only utilizes three fields, Title, Summary and Link.  Without any customization, this simple content entry task is frustrating and the author isn’t happy.  Good news!  We now have the tools to make this content author’s experience better.

Part 1 of this series on customizing the content editor focused on performing actions on fields and sections one at a time. That approach is fine for quick customizations, but with the example above, manually hiding fields and sections can be tedious and time consuming. It would be awesome if we could do this all in one action.  One approach we can take is using an XML document to pass in the field and section information.

I chose XML because it’s basic and Sitecore comes with the HtmlAgilityPack that makes working with Html/XML very easy.  I also wanted to avoid bringing in any other 3rd party assemblies.  I did consider other file formats such as YML and might implement that soon.

The XML

Place this file in the root or create a ContentEditorMappings directory and place it there.

Creating the File Mapping Rule Item

Create a new “Map File” action in the element folder (/sitecore/system/Settings/Rules/Definitions/Elements/Customize the Content Editor) created in Part 1.

  • Map File
    • In the Data section -> Text field, add: Map File: [Path,,,Path]
    • In the Script section-> Type field, add the fully qualified name for the action: Paragon.Sc.ContentEditor.Rules.Actions.MapFile,Paragon.Sc.ContentEditor

The File Mapping Action

The Code to Map the XML

I’ve left out some minor code and I also made a few changes since Part 1.  The source code is coming soon.

If you have any questions, comments or suggestions please feel free to leave a comment, tweet me or Skype me.

Haven’t read the first two chapters?
“MySpace” the Content Editor – Customizing the Content Editor via the Rules Engine – Part 1
“MySpace” the Content Editor – Customizing the Content Editor via the Rules Engine – Part 2: The Experience Editor


Do you enjoy my oddly themed blogs and wish you had access to even more of me and my ideas? Good news, you’re in luck!

If 140 characters is your thing, follow me on Twitter.


If you hate reading and watching Sitecore videos entertains you, head over to my YouTube channel! Sometimes I entertain, sometime I provide useful Sitecore information and sometimes I can do both in the same video.


I can also be found hanging out on the Sitecore channels on Slack, I like it, although it occasionally triggers AOL chat room flashbacks from the olden days.


You can also find me adding content on LinkedIn and on Reddit.

2 Replies to ““MySpace” the Content Editor – Customizing the Content Editor via the Rules Engine – Part 3: File Mapping”

Comments are closed.