Added makedir -p if pagesdir doesn't exist