TIP: Sorting Items with "Sort rank" setting, by Date
Something that came up from our editors was, "How can we sort our newsletter links by date?" We have a page using the List/Links feature to let users download back issues of quarterly newsletters. It's a pain to go through all the items and adjust their Sort Ranks to keep them in order each time a new link is added.
I tested something, and it worked! The "Sort Rank" field will accept negative numbers!
So, to sort items by date using Sort Rank:
- Start the "Sort Rank" field with a negative sign (a dash), to sort with the newest item first. No sign to sort with oldest item first.
- Set the first two digits of the Sort Rank to the year
- Set the last two digits to the month.
- If needed, set two more digits to the day of the month.
If the content editors do this when the items are created, then there is no problem. They must remember to be consistent. Six digits for sorting by month, or eight digits for sorting by day, consistently for every item in the feature.
Examples:
- For the newsletter of September 2011, the Sort rank is -1109. For June 2012, it's -1206. By setting these date codes to negative, they appear with the newest entry on top.
- For issues that come out more than once a month, like June 1 2013 and June 15 2013, it works the same way. Their Sort Rank numbers are -120601 and -120615, respectively. And they are displayed in correct order.
Hope this helps somebody.