skip to Main Content

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 xml view file

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


  1. Chosen as BEST ANSWER

    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


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search