You know the problem. You add all your items, you add all the links so that your items appear as a collection, but you want the order different.
You might want them alphabetically sorted, or by when the item was created or updated, maybe you want them in reverse order? Good news, you can with two parameters, order and direction.
|Value||How the items are sorted|
|c||creation date and time|
|n||default the name of the item|
|t||the title of the first content entry|
|u||date and time for when the item was last updated|
Order specifies what order you would like the items sorted by. You can order by when the item was initially created, when the item was last updated, the title in the first content item or the name of the item. If you do not specify the order, the items are ordered by the item name.
Let us say you have a link /blog that has all your blog items. By default, it will be ordered by name. If we instead wanted the items ordered by creation date, then We would add the parameter order like this
|asc||default sort the items in ascending order|
|desc||sort the items in descending order|
By now you may realise that there are two directions to sort items in either ascending order or descending order. Do you want them sorted a-z (ascending) or z-a (descending). There is another parameter called direction that does this for you.
If you change the link to be like this …
… your blog items will now be sorted by creation date in descending order. If the direction parameter is omitted, the ascending order is used.
OK, We have noticed some clients using a little bit of trickery in their sorting that involves adding numbers to the start of the name of their items. You see, numbers come before letters when sorting and the names of the items aren’t really used anywhere. So what some clients do is to name some of their items starting with numbers to send particular items to the top of the list. If you have a need to force an item to be sorted above all the others when sorting by name, then I say there is nothing wrong with a little trickery!