only add pages to DOM when required