ensure lowercase sort direction, add sort link id