Closed revolutionnaire closed 1 year ago
Hi, could you share the URL where the error occurs? Or, if it is on the main /sitemap.xml for example, please try /index.php?feed=sitemap to see if it occurs there too...
It's suddenly working now. Weird.
Anyway, thanks! The plugin's really awesome!
Sometimes, the XML is generated properly. Sometimes, it's blank. I'm not sure exactly what to do.
Hi, if your XML sitemap appears blank in the browser, it might be a problem with the XSL stylesheet file. This, in itself, is not a problem for search engines (they ignore the stylesheet completely) but it will make your browser show a blank page.
You can verify this by typing Ctrl+U (or Option+Command+U in Safari) to view the source code. If you see code starting with <?xml version=...
then you can safely say the problem is not with the sitemap itself but with the stylesheet...
It's not loading the XML version of the page either. There's only the empty body element along with the Grammarly plugin's markups. I have a plugin to check grammar and spelling.
Here's what the source code looks like:
<html><head></head><body data-new-gr-c-s-check-loaded="14.1113.0" data-gr-ext-installed=""></body><grammarly-desktop-integration data-grammarly-shadow-root="true"></grammarly-desktop-integration></html>
Sorry for the trouble. I really appreciate you taking the time to help me fix this.
Grammarly? Is that a browser extension? If so, it appears to be injecting HTML that will break any XML... Is there an option to turn that off on certain URLs?
You could use an external XML or sitemap validator to see if your sitemap can be read from the outside without any browser extensions interfering... Try https://www.w3schools.com/xml/xml_validator.asp or https://www.xml-sitemaps.com/validate-xml-sitemap.html
Have you got a Google Search Console account? If so, add your XML sitemap there to see if any errors are reported.
Yup, it's a browser extension. I turned it off in the meantime and it's still giving me an empty HTML page but when I used the xml-sitemaps.com it said no issues detected. Sorry, I forgot to mention but the thing that prompted me to do this is when I added the sitemap to the Google Search Console and it said it has errors. This is the exact message: Sitemap can be read, but has errors. Sitemap is HTML. Your Sitemap appears to be an HTML page. Please use a supported sitemap format instead.
So somehow your WP installation or hosing provider is returning HTML instead of XML in the sitemap URL. And apparently his does not happen every time but only sometimes... Is there any pattern that you can find, that would allow us to reproduce the issue consistently?
Have you tried tried to use the external validators multiple times? Maybe quickly repeating multiple validations, triggering a firewall error response?
Or are you using a CDN like Cloudflare that sometimes has trouble connecting to your site? Or maybe your hosting provider is being overloaded? This can happen sometimes but should not be happening very regularly...
You can send me the sitemap URL via https://status301.net/contact/ and I can do some external testing if you wish :)
I honestly don't know what patterns to look for. Can you tell me more about this?
I tried using xml-sitemaps.com again and this time it failed with the same error that Google Search Console gave me. It's loading an HTML file. I guess it's happening randomly.
As far as I know, I'm not using a CDN. How do I know my hosting provider is being overloaded?
I just sent you an email using the contact form you provided. I really appreciate that you're taking the time to help me with this.
Hi, yes got the e-mail. From my side, the sitemap is responding with an HTML "Website Under Construction" message...
I'm using the Maintenance Mode plugin. Is it causing any conflict with the sitemap? I tried disabling Maintenance Mode but it's still giving me a blank page for the sitemap.
Yes, Maintenance Mode is blocking public access to all content of your site, including the sitemap. Is there an option to exclude certain URLs from being blocked in your Maintenance Mode plugin?
There is but the path to sitemap.xml isn't in the options. I tried deactivating the plugin this time and it worked. It wasn't a blank page but it's an HTML version of the sitemap. Is that normal?
Sorry, it's a blank page again. I tried loading the sitemap again while the plugin is deactivated.
This is weird. I am now using a different Maintenance Mode plugin. I tried doing a hard refresh and every time I do it, it loads properly but when it's a normal refresh, it's just a blank page.
Yes, I see that the first request is working but then, the second one gives a blanc result. You can try this by appending the sitemap URL like /sitemap-news.xml?XYZ. Change that XYZ to any random sequence and hit Enter, then the sitemap loads. Then renew and you get an empty result. Change the random sequence after the question mark again and the same thing happens.
I can only conclude the sitemap is being generated correctly but there is something going wrong with the response headers and caching. I think it is the combination of the Etag that is added by your Litespeed server and one of the response headers that is coming from the plugin itself. I'll try to find out more...
Thanks!
Update: would you be willing to do a little test for me? It involves a small modification to one of the plugin files. The steps are as follows:
$headers['Status'] = '200';
//$headers['Status'] = '200';
Let me know so I can test your sitemap again :)
Note: If you get an error after trying to re-activate the plugin, then something went wrong during the modification. Just uninstall the complete plugin and re-install it to get it back as it was before.
No problem. I've made the changes you asked.
OK, that seems to be working. Try /sitemap.xml?test123 for example and reload a few times. From my side that generates the full sitemap in the browser. To get it working for the normal /sitemap.xml URL, you ill need to clear your browser cache because it has cached an empty response. Or you can open an Anonymous/Incognito/Private browser window and try...
It works! Thank you so much!
I suppose I should keep the change we made to the file earlier?
Yes, you can keep the change. I'll be adding this fix to the next release :)
Thank you for your cooperation and bug report!
No problem. You actually fixed it. Thanks again!
Hi! I like this plugin because it's so simple and unintrusive to the WordPress UI. Please help me to get it to work. I'm encountering an error when I view the site's XML sitemap: error on line 18 at column 1: ParsePI: PI php never end. I'm not sure if it's my site or the plugin's fault.