awesomemotive / all-in-one-seo-pack

All in One SEO plugin for WordPress SEO
https://aioseo.com
339 stars 155 forks source link

Bug - Google Search Console expects application/xml content-type header #3096

Closed Blockgeni closed 4 years ago

Blockgeni commented 4 years ago

The sitemap generated is showing an error on google search console "Your Sitemap does not contain any URLs. Please validate and resubmit your Sitemap." The error as per site map validator "

Errors Incorrect http header content-type: "text/html; charset=UTF-8" (expected: "application/xml")

"

Please resolve this bug. Thank you

arnaudbroes commented 4 years ago

@wpsmort can you do some research on this and see what HTTP content-type header Google is expecting from us? Our main competitor is sending out text/xml We've always used text/html, but these errors have been popping up more frequently as of late. Sending out application/xml might be an improvement.

wpsmort commented 4 years ago

@arnaudbroes Google expects text/xml which is what we output (I verified this in the code). However, there is one line of code in the sitemap module where we output text/html below:

https://github.com/semperfiwebdesign/all-in-one-seo-pack/blob/a1d87af89db605e992aeaf266984ceacb50a0c6f/modules/aioseop_sitemap.php#L1646

We could change that one line, although it's only output if the sitemap has no content.

arnaudbroes commented 4 years ago

@wpsmort correct. Since we only output text/html when the sitemap returns a 404, we can safely assume this a not a bug. Therefore I'll go ahead and close the issue for now.

@Blockgeni you'll want to check that your sitemap actually contains any content and that your robots.txt file isn't blocking Google's crawler from accessing your sitemap. Feel free to reopen this issue if that isn't the case.