Display none is not a very good way of removing the header and footer. A better approach would be to create a custom layout template in the theme and remove those sections from the template and then update the layout in the page template JSON schema ...