Configuring XML Sitemap for your Magento 2 website you help Google identify, crawl and analyze your website links better. Google ranks not only the website as the unity of pages but separate web pages as well.
So, you can easily configure XML sitemap for your Magento 2 store manually. However, you can as well configure the Magento 2 XML sitemap autogeneration.
How to configure Magento 2 Sitemap?
Following steps to configure Magento 2 sitemap :
1. Go to Stores > Configuration > Catalog > XML Sitemap. There are several options you have to configure the XML sitemap for.
2. Set Frequency and Priority which you want Categories to be indexed with in Categories Options.
3. Complete Frequency and Priority settings for product Options and decide whether you want to Add Images into Sitemap.
4. Enter Frequency and Priority for indexing your Magento 2 store CMS Pages.
5. Complete General Settings.
- Enable the Sitemap generation.
- Set the Frequency and Start Time you want the XML sitemap to be updated at.
- Enter the Error Email Recipient who will receive the notification in case there is some errors while sitemap updating.
- Select the Error Email Sender and Template to be used as the XML sitemap updating error notification.
6. Set the Site Map File Limits.
- Indicate the maximum number of URLs you want to be included in the sitemap in the Maximum No of URLs per File.
- Enter the Maximum File Size to set the maximum size of the sitemap file in bytes.
7. Enable Submissions to Robots.txt in order to guide search crawlers on how to index your website better.
How to Add XML Sitemap in Magento 2?
In order to Add new XML sitemap in Magento 2 take the following steps:
1. Go to Marketing > Seo & Search > Site Map.
2. Choose an existing sitemap to edit or if you don't have any XML sitemap yet press the Add Sitemap button.
3. Set the name of the XML file of the sitemap in the Filename field, enter the Path where it will be located and press the Save & Generate button.
Once you have finished you'll see the list of Sitemaps.
4. Press Generate a link to generate the XML Sitemap file. Note: a sitemap file is updated automatically by cron, you need to press "Generate" only if you want to update/generate Sitemap XML instantly.
A standard Magento 2 XML Sitemap consists of links for products, categories, static pages, and product images.
How to configure Magento 2 Sitemap Auto-generation?
In order to set Magento XML Sitemap to be generated automatically by Cron please go to Stores > Configuration > Catalog > XML Sitemap and find the Generation Settings section.
In Generation Settings, you have to Enable the autogeneration and set the Time and Frequency you want it to be generated at. We strongly recommend you to set it to be generated daily and at night time. In case something might go wrong and you want to be notified, set the Error Email Recipient, the Error Email Sender, and Error Email Template can have the default values.
Once you have finished don't forget to press the Save button.
In case you want to see how it is done, check out this short video: