I configured the sitemap configurations to update automatic my sitemap.xml and then I generated a sitemap via admin panel, as you can see below:

Magento2 Sitemap XML blank

My Sitemap:

Magento2 Sitemap XML

How to solve it?


You might use a different path in the admin panel, it seems like you are using NGINX so you need to specify the path as the image below /pub/ because using NGINX it is your root folder accessible via the browser.

Magento 2 Sitemap Blank Solution


Firstly set path for your sitemap generation. If that doesn't fix it, try using Xdebug on \Magento\Sitemap\Model\Sitemap.php generateXml() method and see what data it returns.


If you are using Magento ver. 2.1.8 there is a bug that Magento generates the sitemap and robots.txt files in http directory rather than in the http/pub.

If that's the case and you are using NginX, add this to the configuration file to set the path to your

# robots
location = /robots.txt {
    alias /var/www/example.com/html/robots.txt;

# sitemap
location = /sitemap.xml {
    alias /var/www/example.com/html/sitemap.xml;

Also, you can find the bug fix here: https://github.com/magento/magento2/pull/9094

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.