Factor out page templation