Hello,
I apologize for the issue you are facing with the Rank Math sitemap not displaying on your website. Thank you for bringing this to our attention.
Based on the error message you provided, it seems that there is an XML declaration error in your sitemap. This error occurs when there are white spaces or blank lines before the XML declaration in the sitemap file.
To resolve this issue, please follow these steps:
- Check your wp-config.php file and your theme’s functions.php file for any blank spaces or lines before the opening `
Sources:
Rank Math Sitemap Issues and Their Fixes » Rank Math
Thank you for the reply
Well, the sitemap is empty. What could be the issue? I had imported data from Yoast SEO, but we had recently upgraded our website and removed yoast SEO. Right now the sitemap is blank.
Kind Regards
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
For initial troubleshooting, please follow the steps to flush the sitemap cache:
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp
2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
https://rankmath.com/kb/exclude-sitemaps-from-caching/
3. Disable the transient cache for the sitemap by applying this filter. This will make sure that your XML sitemap always reflects the latest changes on your site:
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
If you’re not sure how to add this code, you can follow this guide:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
Thank you.
Thanks for your responses. I appreciate it a lot.
After installing the Rank math I got a slight error on GSC. That says, the page is not indexed due to being blocked by robots.txt
link affected:
https://www.competitionclean.com/wp-admin/admin-ajax.php
I have looked at my robots.txt and I have realized that /wp-admin/ is disallowed. Should I allow this on the robots.txt? What are the repercussions for this?
Thanks and kind regards
Hello,
While you should retain the disallow rule for /wp-admin/
as those directories are not relevant to search engines and may pose a security risk allowing crawlers and bots to access them, you can add the following line to your robots.txt:
Allow: /wp-admin/admin-ajax.php
Allowing access to /wp-admin/admin-ajax.php ensures that necessary AJAX requests can be made, and it won’t affect the security of your site.
You can use Rank Math to manage and edit your robots.txt, to do so kindly refer to this guide:
https://rankmath.com/kb/how-to-edit-robots-txt-with-rank-math/
Please note that you will have to delete the static robots.txt file for Rank Math to generate robots.txt dynamically.
We hope this helps. Please let us know if you have further questions or concerns.
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.