Do not cache your XML sitemaps
If you can’t see your XML sitemap or you get this error from Google Search Console “Your file appears to be an HTML page“:
- exclude XML and XSL files from your caching plugins
- exclude XML and XSL files from Weglot plugin
- exclude XML and XSL files from your CDN (Content Delivery Network)
- update Really Simple SSL plugin to the latest release
My XML sitemap returns a 404 error
Although if we do this automatically, try to flush your permalinks from Settings, Permalinks if you encounter a 404 error when accessing your XML sitemaps.
Read our guide if you still see a 404 error
NGINX user?
You must add several rewrite rules to your NGINX configuration file. Contact your webhost to take of this.
Google Search Console returns errors
Generating an XML sitemap for your images is a daunting task, especially if you are using shortcodes to display your images.
- The first thing to try is to disable the execution of shortcodes in XML sitemaps of images with a hook (paste it to your functions.php file of your child theme / theme)
- Disable Image sitemap from SEO, XML – HTML sitemap settings page, General tab
Google couldn’t fetch the sitemap
This dedicated guide can help you with this error.
My XML sitemap is blank
XSL issue
There may be a problem with the stylesheet associated with the XML sitemap. It may not be loading or has been altered via your theme or a third-party plugin.
Generally, by looking at the source code of the stylesheet, we can quickly find the culprit.
URL of the stylesheet: https://example.com/sitemaps_xsl.xsl
WP Debug
Or, if your index sitemap and / or sub-sitemaps are blank, including your source code, you have to enable the WP Debug feature to get the error. Once the debug is enabled, load again your XML sitemap. The error will appear in your debug.log file.
A URL is missing in my sitemap
Make sure you don’t have set your URL as noindex.
If you have set a custom canonical tag different from your permalink, it will be automatically excluded from the sitemap too to follow Google guidelines.
The source code of my sitemaps shows “extra code”
If you see some PHP or JS scripts related to a third party plugin, you can try to disable shortcode execution by adding this snippet to your functions.php file of your child theme (you can also use a must use plugin if you prefer or if you don’t have this file available, eg Oxygen builder):
My sitemap is too slow
Try to disable Image sitemaps option from the General settings.
XML declaration allowed only at the start of the document
If you open the source code of you XML sitemaps, the first line is probably empty hence the issue.
This error is generally a bad opening / closing of the <?php
tag.
Check your header.php, functions.php files of your theme, and also wp-config.php file.
My XML sitemap still doesn’t work
Open a support ticket from your customer area. If you’re a Free user, create a topic on w.org forum.