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())
{
return;
}
var sortOrder = string.Empty;
switch(item.Name)
{
case "January"
sortOrder = "1";
break;
case "February"
sortOrder = "2";
break;
...
default
return;
}
using (new SecurityDisabler())
{
item.Editing.BeginEdit();
item[Sitecore.FieldIDs.SortOrder] = sortOrder;
item.Editing.EndEdit();
}
...