refactor index page generation to pages.ml