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 having an XML sitemap on your website contributes to your SEO improvements. You can easily configure the it for your Magento 2 store manually. However, you can as well configure the Magento 2 XML sitemap autogeneration.

So, in this article you will learn:

How to configure Magento 2 Sitemap?
How to add XML sitemap in Magento 2?
How to configure Magento 2 Sitemap Auto-generation?

How to configure Magento 2 Sitemap?

In order to configure XML sitemap in Magento 2 take the following steps:

1. Go to Stores > Configuration > Catalog > XML Sitemap. There are several options you have to configure the XML sitemap for.

Magento 2 XML Sitemap Configuration

2. Set Frequency and Priority which you want Categories to be indexed with in Categories Options.

Magento 2 Sitemap Category Options

3. Complete Frequency and Priority settings for product Options and decide whether you want to Add Images into Sitemap.

Magento 2 Sitemap Product Options

4. Enter Frequency and Priority for indexing your Magento 2 store CMS Pages.

Magento 2 XML Sitemap CMS Pages Options

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.

Magento 2 Sitemap Generation Settings

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.

Magento 2 XML Sitemap File Limits

7. Enable Submissions to Robots.txt in order to guide search crawlers on how to index your website better.

Magento 2 Sitemap Search Engine Settings

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

Magento 2 XML Sitemap Configuration

2. Choose an existing sitemap to edit or if you don't have any XML sitemap yet press the Add Sitemap button.

Magento 2 XML Sitemap Configuration

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.

Magento 2 XML Sitemap Configuration, New Site Map

Once you have finished you'll see the list of Sitemaps.

4. Press Generate a link to generate the XML Sitemap file. Note that a sitemap file is updated automatically by cron, you need to press "Generate" only if you want to update/generate Sitemap XML instantly.

Magento 2 XML Sitemap List

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.

Magento 2 XML Sitemap Autogeneration

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.

Magento 2 XML Sitemap Auto-generation

Once you have finished don't forget to press the Save button.

Magento 2 XML Sitemap Configuration Save

In case you want to see how it is done, check out this short video: