refactor: move all of the page body rendering code into a new file and a new template