The Problem
When checking the sitemap on a Hugo website (e.g., hosted on GitHub Pages), you might occasionally land on an HTML page (/sitemap/) where all URLs are jammed together without formatting or separating tags. Search engine crawlers (like Google) fail to parse such invalid sitemaps and will reject them entirely.
The Solution
You can force Hugo to generate a clean, valid XML sitemap by providing a custom layout template.