Sort the pages by categories.