I'm working on a web application written with AngularJS (v8) and deployed on an apache2 using proxy to forward requests (frontend, api, backoffice).

My problem is that I'm trying to submit the sitemap ({website}/sitemap.xml) on Google, but Google Search Console keep saying that it's not valid: Google can read the link but it seem to be in HTML


My sitemap: sitemap

I tried to validate that XML on many website and I didn't find any error.

I mentioned apache2 because maybe when Google try to fetch the URL, before finding the XML, apache give another page but I cannot prove that. I tried in many ways and the first page that I see when opening the URL is the sitemap and nothing else.

In my angular.json I added the file in the assets as follow:

"assets": ["src/favicon.ico", "src/assets", "src/sitemap.xml"],

What it can be?

  • Can you use curl --head http://example.com/sitemap.xml from the command line and report what Content-Type is returned for your sitemap? – Stephen Ostermiller Jun 15 at 9:57
  • The screenshot of your sitemap doesn't include the required first line <?xml version="1.0" encoding="UTF-8"?>, nor does it include required attribute on urlset: <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">. I think that is because you have taken a screenshot from a rendered version of it rather than a screenshot of the source code. Does the source code have these required elements? – Stephen Ostermiller Jun 15 at 9:58
  • @StephenOstermiller Content-Type: application/xml, the first line is included but firefox removed. If I check the page content I can clearly see those 2 at first: <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> – S. Mohamad Jun 15 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.