converting pages to array to make it easier to work with in templates