My Umbraco 8 XML sitemap is displaying html tags and I don’t know why! Content Type header shows it’s a text/xml document, but when inspecting elements the page includes html markup. The sitemap is using a cshtml template as directed by Umbraco documentation on creating an XML sitemap, with Layout = "null". What could be the issue here? And is it an issue to begin with? This is for SEO purposes, not for people to be reading, so it needs to be a proper XML sitemap.
Screenshot of sitemap with dev tools network tab open, showing the content type header is text/xml
Screenshot of sitemap with dev tools elements tag open, showing the file contains html tags
2
Answers
Turns out it's not actually HTML. I think the browser does it? When viewing page source, it is indeed XML, but when inspecting the elements, it does contain HTML
I’m pretty sure the HTML you are seeing is from the browser tool that’s displaying the XML for you. It’s not your code.