Move next/prev links into template