Tag Archives: Sitecore

During planning of a large migration for a customer, we needed to know what components was actually in use on certain types of pages. I chose to use Sitecore Powershell Extensions to extract that data.

You can find Sitecore Powershell Extensions here:

Sitecore Powershell script to list Renderings

The components mentioned above was included on “article” pages through renderings, so what I needed to was create a script that looped through all pages of template type “article” and picked out all the items in “final renderings”.

I wanted to output this to a comma separated file where its easy to filter and sort on the data on the fly in excel.

Here is the script I ended up with:

write-host 'Running script...'
Set-Location master:\content #this was nessesary in my case, because the original "home" item was deleted and SPE had a bug (now fixed)
$pages = get-item master:\content\MySite\articles | get-childitem -Recurse | where-object { $_.TemplateName -match "Article" }
$device = Get-LayoutDevice -Default
$Results = @();
$DataPath = "C:\MySite\ComponentsInUse.csv"

foreach($page in $pages){

    $renderings = Get-Rendering -Item $page -Device $device -FinalLayout

    foreach($rendering in $renderings){

        if($rendering.ItemID -ne $null)
            $renderingItem = Get-Item master: -ID $rendering.ItemID
            if($renderingItem -ne $null)
                $Properties = @{
                    RenderingItemName = $renderingItem.Name
                    RenderingItemID = $renderingItem.ID
                    RenderingItemPath = $renderingItem.Paths.Path
                    UsedOnPage = $page.Name
                    UsedOnPageID = $page.ID
                    UsedOnPagePath = $page.Paths.Path

                $Results += New-Object psobject -Property $Properties


$Results | Select-Object RenderingItemName,RenderingItemID,RenderingItemPath,UsedOnPage,UsedOnPageID,UsedOnPagePath | Export-Csv -notypeinformation -Path $DataPath

write-host 'Script ended'

Useful Sitecore Powershell Extensions links

You can find a lot more useful Sitecore Powershell Extensions information on Adam Najmanowicz blog:

Thanks to Bill Dinger for this post:


Sitecore error: The item “/sitecore/content/Applications/WebEdit/WebEdit Texts” was not found. It may have been deleted by another user.

This is one of the more difficult errors I have had to pinpoint, so I hope this blogpost will help whoever might experience the same issue. Below is a screenshot of the error I got:

Webedit text not found

The stacktrace of the error

The above error message was suddenly starting to get thrown from Sitecore out of the blue, everytime I tried to edit a page in the experience editor.

I had not edited any code even remotely related to this and the item that is mentioned in the error message, was there. And everything was still working for the other members of my team. The error seemed to be isolated to my local enviroment.

After rebuilding the solution, rebuilding indexes, checking all of the code mentioned in the stacktrace, deleting everything and starting over, copying a solution from a collegue, checking .NET versions, IIS settings, etc. I was quite at a loss of what to do.


Chrome’s caching seems to be the culprit

A collegue suggested trying a different browser, than the Chrome I always use, even though this clearly is a serverside error, right?! I fired up firefox, and everything worked fine… So the error was localized to Chrome. I then deleted all the cache from Chrome, and the error disappeared.

Too much caching...

Grumpy cat goes smashing

The conclusion of all this shenanigans seems to be that Chrome’s caching algoritms might be too aggressive when using the Experience Editor.

Clear your browser cache!

How many servers do I need to run Sitecore?

Warning: This post contains no code. But it does have very useful information for estimating Sitecore server setup size! 😉

The question above is frequently asked in a new Sitecore project. (Actually, if it isn’t, you should be worried). And there is no easy answer. It’s a bit like asking: “How big a house do I need?”.

The answer to both questions is “That depends”. (and no one is any wiser). Below I’ll list some of the things you need to consider, when trying to decide what kind and how big of a server setup you need. This won’t answer your question, but leave you with many more. However if you try to find some answers for those questions, you will be a lot better qualified for estimating your Sitecore server setup.

I will also provide a real world story to showcase a server setup that works for Sitecore and one that does not.

Sitecore’s minimum server setup

A while back I was starting up a new Sitecore project for a smaller client. They had a very tight budget and wanted real world advise for a minimum Sitecore Server Setup. They came from an older 6.0 Sitecore version with 1 Content Delivery Server (CD), 1 Content Management Server (CM) and 1 MSSQL server. 3 machines to run their (small) corporate website. There was also an integration to an older Dynamics AX server, containing ERM/CRM data. The client had around 5000 users, logging into the site 1-2 times a month (so quite a small site). The new site was a complete greenfield project (i.e. start from scratch) on Sitecore 8.0 (complete with Mongo, Solr, Analytics, etc.), and a reworked integration to Dynamics AX.

I asked around my colleagues at Pentia, to find some official recommendations from Sitecore or from other project we did at Pentia. And every time I asked the question, the answer was “That depends”, which of course it does. Part of the problem was that pretty much no one had done a Sitecore 8.0 project at that time and Sitecore 8.0 was a big change to Sitecore from previous versions. However, my colleague Thomas Stern (, had gone through the same ordeal and had pieced together this diagram during meetings at Sitecore:


Sitecore minimum server setup

Sitecore minimum server setup


10 servers. 10. Sitecore recommends 10 servers to run a small business site. That would be a complete no-go for the client, which was used to having 3 servers to run their site. Granted, Sitecore has become a much larger beast in the later years and targets much larger clients now. But smaller clients, like this example, still exists and has bought a Sitecore license, which gives them access to newer Sitecore versions too. I think Sitecore might have forgotten that, in these recommendations.


My minimum Sitecore Server setup recommendations

So I set out to create our own minimum Sitecore server setup recommendations for this small type of client. I considered the following things, which you also should do, when planning your server setup:

  • The amount of users and page hits
    • The most obvious parameter when estimating server needs is how many page hits are you going to have. And this is quite important. So try to find out some how. If you have an old site, run some statistics for a while. If not, do some sort of analysis.
  • Proper, fast performing, well thought out code.
    • Even if you do not have that many page hits, you can still get a badly performing site. This is often due to bad code, which is very common. Your developer needs to know the pitfalls of Sitecore and how to avoid them, to do a properly performing site.
    • At Pentia we have done Sitecore development since Sitecore was created. And since Sitecore was created at Pentia, we know a lot about Sitecore! We know what not to do when coding Sitecore and what the pitfalls are. Therefor I know that our code will be very well tailored for Sitecore and perform well. This means that the client can do with less CD servers and less CM servers.
  • Downtime
    • The client  would be OK with brief periods of downtime during deployments and upgrades. This means that having a single CD server would be an option. Having 2 CD servers would enable you to take 1 server down for an upgrade while the site would still be running. Having only 1 server, saves cost, but means that the site will be down during upgrades. Some clients (mainly smaller clients) are perfectly OK with this.
    • The triple redundant Mongo server setup is way, way overkill for a small client. Yes, Mongo needs 3 servers to be able to do upgrades and restoring without downtime, but smaller clients may not need 100% uptime, if it means saving 2 servers.
  • Amount of usage of Solr Search
    • If the site in question don’t use search very much, you might not need a standalone Solr server. The site in question did you search a bit, but has so few users, that it does not really justify a standalone Solr server. However, if your site uses search or filtering on searches a lot, you might need a standalone Solr server.
  • Amount of use of Sitecore Reporting and Analytics
    • The client in question was not planning on using Sitecore reporting or analytics much, if at all, to begin with. They might later, but then there is the option of adding a Reporting or Analytics server at that time.
  • Amount of caching and interaction with other systems
    • Oftentimes, interaction with 3rd party services or other systems that provide data or communicate with your site, are able to slow your site down. The user cannot see that your site is waiting for Dynamics AX to finish a webservice call to get data or something similar. To the user, it’s your site that is slow. Therefore you might need to do a lot of caching of data from the 3rd party services and store them on your servers RAM. This directly affects the amount of RAM your server needs.
  • How many editors work simultaneously
    • If you have many editors working at the same time, you might need more than 1 CM server.

There are many more factors to consider and many aspects will be different in your site, but the above points will help you along.

Below is the setup I ended up recommending for this particular client. I kept the server scale (i.e. RAM and CPU) the same.

  • 1 dedicated CD server to serve content to the users
  • 1 SQL server that holds all databases
  • 1 CM server that also doubles as Solr, Reporting server and Analytics server.
  • 1 MongoDB.
My minimum Sitecore server setup

My minimum Sitecore server setup

So we went from a 10 server setup to a 4 server setup, which I’m relieved to see perform just fine, with muscles to spare for even more future users.

A too small Sitecore server setup

After a while, the client decided, by themselves, to try to scale the servers down, in an attempt to save money on hosting. They told their provider to cut the CPU and RAM by half on all servers. We found out, when they called us because the site was down.

This is what a CD server with 2 CPU’s and 7 GB of RAM looks like:


CPU is maxed out

CPU is maxed out

This resulted in a site that either did not respond, timed out or responded in around 50+ seconds on a simple frontpage. You can safely assume that the above 4 server setup, with half the CPU and RAM, is not enough to run a small Sitecore site with normal use of search, reporting and analytics.

Consider cloud hosting

You should also consider using cloud hosting, such as Azure, which the client in question used. The great advantage here is that they are able to add or remove servers extremely fast and throttle the servers up or down as needed. This is extremely versatile and should not be under valued. If your analysis of your hardware needs was wrong, you can relatively easily correct your mistakes in the cloud.

However, it comes with trade offs. Usually, when hosting in Azure, your hosting partner, if you even use one, has no clue what Sitecore is and will be completely unable to help with any Sitecore related tasks. Be it setup of windows services that Sitecore needs, knowing what Sitecore requires or tweaking the server for Sitecore etc. This means that you need to spend time and money on handling these things yourself or pay someone else to do it.

You also don’t necessarily know where in the world your data lives, which can violate local legislation in some countries.

Finally, it can become quite expensive to host a site, and corresponding test and pre-production sites, in the cloud. You absolutely need to do the math on this before you decide.

So, how many servers do you need to run Sitecore?

There are many factors to consider, as you can see. There are no simple answer to this. You need to do an analysis of you needs and your circumstances. Counsel your Sitecore partner and try to come up with an answer that suits your needs.


Lately I have been implementing an integration from Sitecore to Axapta to show and create membership data for a client we have at Pentia. The client had their Sitecore site developed by a different consulting firm and they didn’t do a very good job. Hence the client asked us to take over, sort it out and create the Axapta integration into the existing site. It is always a challenge to take over a site developed by someone with a different approach to standards, quality and software development as a whole. Often times you find bits a peaces where you go ‘wtf where they thinking?’…

Setting up a different device to return ajax in Sitecore

Anyway, I had a page displaying a searchresult with a “Show more” button at the bottom. This button did an ajax call to the same url, adding, amongst others, an “ajax=1” query parameter. I then had setup an ‘ajax’ device in Sitecore that picked up that parameter.

Ajax device

Setting up the ajax device. not the querystring parameter


Then I setup a layout with no other content that a contentregion and connected that to the item containing the searchresult. On the searchresult item there’s a ajax-returning control tied up on the ajax device.

Item setup for ajax

Item setup for ajax

This is a method I have used before and it works fine. Only, it didn’t on this site. Here it didn’t return ajax, it returned the entire page again, on the standard layout.

Check your web.config

I spent some time figuring out what was going on here. It seemed that Sitecore did not at all pickup on the querystring and didn’t change the layout. I spoke to my colleague Alan Coates who suggested to write a pipeline processor for debugging the device detection in the “httpRequestBegin” pipeline. Something he did a number of times, on other projects which we took over from other consultant firms. He promised to write a blogpost about it, which I will link to when ready.

Instead I went back to the solution in visual studio and starting searching for device related settings and properties. In the web.config, I found a “device” setting in the website node which was set to the device that it kept returning:

Sitecore Device setting overrides detection

Sitecore Device setting overrides detection



It turns out that this setting overrides Sitecores automatic device detection. After removing this setting, everything works as intended.



Please leave a “Like” and/or use the share buttons, if you found this guide usefull

Sitecore notification bar

A client had a request to have a warning in the page editor when the authors was editing a cloned item.

I wanted to add a bar below the ribbon to do this and found the notification bar which is excatly that. This is what the end result looked like:

Notification bar example

Notification bar example


The getPageEditorNotifications pipeline

To do this you simply do a pipeline processor that hooks into the ‘getPageEditorNotifications’ pipeline which you configure in web.config like this:

  <processor type="CodeBuildPlay.Pipelines.ItemIsCloneWarning, CodeBuildPlay.Cloning"/>

Then you make a public class with method name ‘Process’ that has the ‘Sitecore.Pipelines.GetPageEditorNotifications.GetPageEditorNotificationsArgs’ as an argument, and you are done! Simple!

This is my code:


public void Process(GetPageEditorNotificationsArgs args)
   Item item = args.ContextItem;
   if (item == null)

   if (!item.IsClone)

   string message = "Be aware that this item is a cloned item!";

   PageEditorNotification warning = new PageEditorNotification(message, PageEditorNotificationType.Warning);

      warning.Icon = "Applications/16x16/warning.png";


Read more about the notification bar here:



Please leave a “Like” and/or use the share buttons, if you found this guide usefull.

This is the third post in my series about the Rich Text Editor (RTE) in Sitecore. You can find the first post which is about the basics of setting up the RTE here.

Copy-paste wrecks your day

Now you set up your editor and blocked access to the HTML edit buttons, so you might be thinking that you are safe and the authors cant possibly wreck your site now. Well, they are a ressourceful people those authors and it won’t take them long to figure out that they can copy-paste all kinds of HTML or even word-formatted text into your beautiful W3C compliant website. And having word formatted tags and other shenanigans in your website, definitely does not make it W3C compliant, uniform or maintainable.

Word formatted HTML (It rimes with 'Hell' for a reason)

Word formatted HTML (It rimes with ‘Hell’ for a reason)

Luckily the Rich Text Editor is a powerful tool and comes with mechanics to strip tags when pasting.

How to strip tags automatically

Under the hood of the RTE lies the Telerik RadEditor. This control has a property called “StripFormattingOnPaste” which is described on teleriks website here:

As you can see in the link above, the editor provides many different ways to strip tags. In this example we are going to use the MSWordRemoveAll option, which strips all those nasty word tags.

What NOT to do

Some guides on the internet will tell you that you can simply go into the filesystem in “www\sitecore\shell\Controls\Rich Text Editor” and start changing the markup and scripts of the editor. While this might work, it is NOT the way to do it. These files ships with Sitecore and as such can be overwritten at any time, when you either upgrade sitecore or install a sitecore patch. Generally you should never edit files that ships with Sitecore. In Pentia we live by this rule as we use a component based development approch, creating our custom code in well defined components which is then added ontop of Sitecore. This way we don’t break sitecore and keep the solution able to be updated or patched.

Using the EditorConfiguration class and SetupEditor method

Sitecore supplies a way to configure the editor without changing the files that comes with sitecore. You can extend the ‘Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration’ class and override the ‘SetupEditor’ method, where you can set all the settings you need on the editor. This method is then run everytime the editor is loaded.

To strip all word tags, simply do this:

using Telerik.Web.UI;
using Sitecore.Data.Items;

namespace CodeBuildPlay
  public class RichTextEditorConfiguration : Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
    public RichTextEditorConfiguration(Item profile)
      : base(profile)

    protected override void SetupEditor()
      Editor.StripFormattingOptions = EditorStripFormattingOptions.MSWordRemoveAll;
      //Set additional properties of the Editor here if needed.

Alas, a caveat

All this applies to the Rich Text Editor. Unfortunately it is still possible to paste html directly into in the page editor in Sitecore. In the wededit version of the Rich Text Field, anything can be pasted and there is no way to strip anything. How Sitecore have missed this, is beyond me, but they confirmed, in a supportcase I opened, that there’s no way around it at the moment.

Text pasted from word in page edit

Text pasted from word in page edit




Please leave a “Like” and/or use the share buttons, if you found this guide usefull

This is the second post in a series about the Rich Text Editor (RTE) in Sitecore. You can find the first post which is about the basics of setting up the RTE here.

Restrict the Authors

So you have now created your own HTML Editor Profile and configured your site to using it. The authors can now no longer press a button to insert those nasty tables and use Comic Sans! Hooray!! Well… they can still switch to HTML mode and insert and edit the raw HTML of the field. So nothing is stopping them from googling their favourite spinning icon inside a table with text in Comic Sans and paste all of it into the HTML.

There are 2 places that the authors have access to the raw HTML. In the bottom of the Rich Text Editor, there is a pane that gives access to the raw HTML.

HTML edit button in editor

The HTML edit button in the Rich Text Editor

And in the Content Editor, just above a rich text field, there’s a link that says “Edit HTML” which does just that.

HTML edit button in the content editor

HTML edit button in the content editor

Configuring HTML access

Luckily Sitecore makes this task easy as it is possible to restrict access to these functions through access rights. This means that you can block HTML edit from your Authors while administrators still can edit HTML.

In the Core database, navigate to ‘/sitecore/system/Field types/Simple Types/Rich Text/Menu’. Here you will find the “Suggest fix” and “Edit HTML” which are shown as links in the Content Editor as seen above. We also want to remove the ‘Suggest fix’ as this function sometimes can break your HTML if you don’t know what you are doing.

Restrict HTML edit and suggest fix In the Content Editor

Restrict HTML edit and suggest fix In the Content Editor

Select the Edit HTML item and open the Access Viewer found in the menu under the Security tab. Here you will see what kind of access rights are assigned. You will need to find out which role your Authors have. Usually it will be the “Author” role, but this usually differs between various sites. Still having the Edit HTML, open the security Editor from the menu.

The Security Editor

The Security Editor

In this case the Authors don’t have any special rights assigned, so we need to select the using the “Select” button in the top left. This opens a pop up window where we can find the Authors role and select it. Then, ensuring that the Authors role is selected in the pane above, click the ‘x’ on the ‘Read’ column beside the Edit HTML item. Then do the same for the ‘Suggest fix’ item.

Remove the Read rights from both items

Remove the Read rights from both items

This fixed the problem in the content editor. Close the security editor and access viewer and navigate to ‘/sitecore/system/Settings/Html Editor Profiles/Rich Text XYZ/WebEdit Buttons/Edit html’ (the path of the profile of your Rich Text Editor), and repeat the process above to remove the Read access rights for the Authors.

Your Authors can now no longer Edit HTML in the Content Editor or in the RTE.

The next article in this series about the Rich Text Editor in Sitecore, will show you how to prevent your Authors from pasting formatted word text, HTML tags etc. directly into the editor, destroying your W3C validated site.


Please leave a “Like” and/or use the share buttons, if you found this guide usefull

Sitecore tackled

Small posts about Sitecore and solutions

Cooking with Sitecore

Diary of my experience working on great CMS called Sitecore

Visions In Code

Never look back

Cook 4 Passion

Food food fooooood. We love fooooooooood !!!


Sitecore, Digital Marketing, Work, Life and so on...

Down the DLL Rabbit Hole


Arash Sarfehjou

.NET code and tweaks

.NET code and tweaks

The grumpy coder.

.NET code and tweaks

Alan Coates - Sitecore/.NET blog

Pushing Sitecore to the limits and beyond

Patrick Delancy

i write code

Laub plus Co

.NET code and tweaks

iStern Blog

A simple Code Blog

Brian Pedersen's Sitecore and .NET Blog

Sitecore, C#, ASP.NET for developers