We need to modify the folder structure of bucktable items, Sitecore default short this based on the dates but how to setup this based on the months.

Example - The current folder structure is:


Expectation is 2017 January February March

Anyone know how to setup this type of structure

  • Are you asking about how to sort the bucket folders? Sep 15 '17 at 4:14
  • I am asking how to short based on months like January, February etc., I am aware of default shoring and can be changed through the configuration, we can also extend this bucktable through the existing class, but is there any default option available in Sitecore to short based on Months Sep 15 '17 at 10:07
  • Any reason you want the names? Can you just not use month numbers, which you can do with OOTB functionality.
    – jammykam
    Sep 17 '17 at 15:54
  • @jammykam that the requirement from the client, As there existing system had this functionality, I am assuming they had used item:saved event and some custom code, We don't have that code base and don't want to go with custom implementation, that's why this has been asked like is there any default option available? Sep 18 '17 at 14:47
  • Just because something works a particular way currently doesn't mean it should not be challenged. Seems strange you don't have the codebase, even a production instance which can be decompiled. ¯_(ツ)_/¯
    – jammykam
    Sep 18 '17 at 18:13

Unfortunately, there is no native way to sort the folders into sequential order unless you change the month folders to be digits, I.e. Change "January", "February"... to "01", "02"...

The reality is that unless you're having your users view item buckets, which is not recommended except in special circumstances, then they will never see those folders.

If your users are able to see the folders and you really have your heart set on sorting them then what you can do is add some custom logic that runs when an item is created that tests whether or not the item is a bucket folder (using Sitecore.Buckets.Extensions) and if so sets the _SortOrder field appropriately. You can either do this with an item:created or item:added event, or with a custom <addFromTemplate> pipeline processor. There are several examples of these online, so I won't repeat them here. As for the logic, you can use something like the following:


if (!item.IsABucketFolder()) 

var sortOrder = string.Empty;
    case "January"
        sortOrder = "1";
    case "February"
        sortOrder = "2";

using (new SecurityDisabler()) 
    item[Sitecore.FieldIDs.SortOrder] = sortOrder;

  • Thanks @Zachary for your inputs, I just wanted to avoid this additional operation, I thought this can be handled through Sitecore settings. Sep 15 '17 at 16:03

There is no out of box method provided by Sitecore for this. You can create dictionary items based on month names and keep values as 1, 2, 3... for them . Then you can create a custom handler for item:created event and update the item _SortOrder field value from corresponding month dictionary item value.

  • Can you provide some code, please? Sep 15 '17 at 16:15

After a lot of investigation and asked to Sitecore team, We have implemented this through below approach - Suggested by Sitecore support ticket.

Actually, there is no setting which can change the behavior of the sort order according to your needs.

As per current implementation, We have created a custom "BucketFolderPathResolver" class to generate the month names (e.g. January).

To resolve the requirement we have changed the folder structure and it works for us.

Resolution – We have added the number of the month to the names.

2017 01-January 02-February 03-March

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.