Refactor frontend template into base and index templates.