Site icon Horizontal Blog

Sorting items in Sitecore

One of the useful feature in Sitecore is Sub items sorting. Many times need arises for a group of items to be sorted in a particular order. Sorting helps content authors to find their content easily and to create a proper navigation. Firstly I figured out how the Sitecore actually sorts items in the content tree. To explain this further have created few test items. By default the Sitecore sorts the item by their name.

Sub items can be sorted manually by using the buttons in sorting group of the Home ribbon or by right clicking that particular item.

Sitecore has its own inbuilt sub items sorting methods. To view the list of in built options available for subitems sorting right click on the parent item and choose Sorting and Subitems Sorting or select the sorting option on the ribbon as mentioned above.

Below is screen grab which shows the inbuilt default sorting options available in Sitecore.

Further let’s understand the default six inbuilt sorting options of Sitecore and for this I have created 3 test items in the below order:

Created
This option allows to sort items in ascending order by their created time. The oldest item created should display first. So the Created sorting option would be display the above test items sorted in the below order as per below screenshot.

Default
It allows us to sort the items in ascending order by their names. Default sorting is case insensitive.

Display name
This option sorts the items in ascending order by their display names. Here if the display name doesn’t exist then the item name is used for sorting.  Also here numbers are considered by their numerical value instead of ASCII code value.

Logical name
It sorts the items in ascending order by their names and is same as the display name sorting. Here too the numbers are treated by their numerical values instead of ASCII code value. Order would be same as the Display name sorting.

Reverse
It sorts the items in descending order by their names and numbers are treated by their ASCII code.

Updated
This option would always sort the items by their updated time. The item last modified would appear first in the order. For this I have updated ‘test item 10’ lastly so the sorting by ‘Updated’ option would display the items in the particular order.

Sort Order
Sortorder value takes preference over the default sorting by name. The Item’s children are sorted first by Sortorder and then by Name. On changing the sort order manually then sitecore will insert a value in the Sortorder (_sortorder) field in the Appearance section of the standard fields.

Exit mobile version