Magento 2 XML sitemap is a file containing a structured list of all URLs of your website. Besides, it provides Google bots with some additional metadata about each page like its priority towards other pages, frequency of being updated etc.
Having access to such information web crawlers can correctly understand your website organization and index its content faster.
How to Generate Magento 2 XML Sitemap?
Go to Admin >> 'Marketing' and under 'SEO&Search' select 'Site Map'. Press 'Add Sitemap' and fill in the required information:
Enter the sitemap name in 'Filename' field;
Input the sitemap path to specify where it will be placed on the server. Check if the path is writable. You can use '/sitemap/' for placing it in 'sitemap' directory or '/' for placing it in the root of your Magento;
Please, note: It is recommended to choose the second variant (root of your Magento installation) and here is the reason: putting the sitemap to let's say www.mag-manager.com/media/sitemap will direct web crawlers only to pages starting with www.mag-manager.com/media.
Select Magento storeview.
To complete the generation, press 'Save & Generate' button. It might take a few minutes for the sitemap to show up in the grid.
How to Configure Magento 2 XML Sitemap?
Magento 2 supports XML sitemap auto-generation on daily, weekly or monthly basis. But this possibility is available only if you have already created an XML sitemap manually.
Use this guide to configure sitemap.xml in Magento 2:
From admin panel go to 'Stores' >> 'Configuration' >> 'Catalog' >> 'XML Sitemap'.
Use 'Categories Options', 'Product Options' and 'CMS Page Options' to configure the frequency and priority of these pages. For enabling the fields, uncheck Use system value box.
You can also enable adding all, base only or none product images to sitemap by selecting corresponding options in 'Product Options'.
Please, note: It would be reasonable to add only base images for the sitemap not to be overfull.
Generation options allow you to enable sitemap generation and configure this procedure by:
setting its start time (Start Time);
setting its frequency (Frequency);
specifying the recipient of notification if an error occurs during the sitemap update (Error Email Recipient);
specifying the sender of error notification (Error Email Sender);
selecting the template for error e-mail (Error Email Template).
It is also possible to specify the maximum number of URLs per file (the default limit is 50, 000) and maximum file size (the default size is 10, 485, 760 bytes). These options are especially useful for websites with large sitemaps, as they allow to track what pages were not indexed and make sure your sitemap is not slowing down the site.
In order to submit the sitemap to robots.txt file, select Yes in Enable submission to robots.txt file drop-down. Activating this option you will allow to automatically submit every generated sitemap to the robots.txt file.
Submitting your sitemap to robots.txt file you will instruct web crawlers on what content must not be processed.
Having completed the configuration, press 'Save Config' to save the settings.
By creating Magento 2 XML sitemap you increase the chances to move your SEO positions higher in a big way. This tool serves as a guide for both users and search engine crawlers and seems to be a must-have for every Magento-owner.