Support ordering pages and articles when iterating in templates. 

I've merged #836 from @davidmarble with current master and added the tests from @malept fork.

By default pages are sorted by filename and articles by slug. It can be changed with ARTICLE_ORDER_BY and PAGE_ORDER_BY settings.