More Power to Content Editors

More Power to Content Editors

Sitecore Content Editors  are responsible for all aspects related to the website content. This includes the management of definition items, writing or editing content, organization of items in the content tree  and etc.

They might work together with marketers and designers in order to create specific content and better user experience.  The amount of activities they get involved will depend on a series of considerations involving their company structure and website features available to execute their work.

In order to provide high quality content presentation editors need to know quite well which and what Sitecore features are available. A Sitecore expert should be allocated to perform a training or a knowledge transfer session to content editors so they can have a deeper understanding about Sitecore Editing Tools such as Content Editor and Experience Editor.

Some time ago I had the pleasure to work with a very experienced Content Editor. He had previously worked with software development and had some knowledge of JavaScript and CSS at certain level. Obviously having development skills is not required nor even necessary for a Content Editor. Far from that! Sitecore is very well designed and offers high level features developed and improved along the last 16 years to make a Content Editor’s life very simple!

Considering this context, this is the reason I am writing this article.

How about giving a bit more power to content editors so they can have more control and management of their content?

I created a very simple and powerful solution to give editors the possibility to interact with all pages of the website without necessity to allocate a developer to do the changes for him.

Let us check this fairly simple code below.

In the ‘Mainlayout’ on BODY tag I simply inserted on CLASS attribute the name of the page in context and the name of the template in context.

<body class="<asp:Literal runat="server" ID="ltrPageNameTemplateToClass" />">

The following code inserts the name of the page and the name of the template.

// insert the name of the item (as in the url) in the body CLASS
// insert the template name with hyphens in the body CLASS
ltrPageNameTemplateToClass.Text = Sitecore.Context.Item.Name.ToLower().Replace(' ', '-');
ltrPageNameTemplateToClass.Text += ' ' + Sitecore.Context.Item.Template.Name.ToLower().Replace(' ', '-');

The result would be as the following example:

<body class="ContactPage ContactTemplate">

Then I created 2 other tags as below:

<asp:Literal runat="server" ID="BeforeClosingHeadTag"></asp:Literal>

<asp:Literal runat="server" ID="BeforeClosingBodyTag"></asp:Literal>



To have this working I created the following template named ‘Custom HTML’:

Almost there! I created a definition item named ‘Custom HTML’ based on the recently created template ‘Custom HTML’ on a settings folder and set proper security permission to this item.

That would be all!

This gives the content editor possibility to interact with any page by typing JQuery commands, JavaScript, HTML and CSS.

What could be done is unlimited and it could potentially break the website. This could generate some discussion so before you  implement this solution please make sure you have this previously approved by your manager.

I really hope you have enjoyed your reading and should you have any questions please do not hesitate to contact me.

Best Regards

Leonardo Cunha

Leave a Comment

%d bloggers like this: