Fix editing pages to reuse the existing tree and implement repo template writing