How to Configure Magento 2 XML Sitemap?

Magento 2 XML sitemap is one of many Magento SEO features that contribute to your website ranking. But that's not only that. The Magento sitemap is the main element linking your store with potential customers from search. If search robots can't discover your store, you won't get into Google index and the rest of the picture doesn't look good.

That's why it is important to understand the concept of Magento XML sitemap better. So, today you'll discover everything you need to know about Magento sitemap, how you can configure and automate it.

What is Magento XML Sitemap?

Magento XML sitemap, like any XML sitemap, is a file that contains links to all pages of a website. You submit this file to Google Search Console so that search bots can crawl and index your pages, which, correspondingly, are ranked in Google.

Products, categories and CMS pages are all included in the Magento XML sitemap. Besides, you can define how often robots should crawl these pages. The only downside is your pages are added to the crawling queue. So you don't know when Google will actually crawl your pages, unlike with the Google Indexing API

But there is more to it. So we move to the next section to learn how you can configure the XML sitemap in Magento. 

How to Configure Magento 2 XML Sitemap?

Magento sitemap configuration usually includes two steps if you're starting from scratch. First, you need to configure the basic settings like frequency and priority of indexing, and then actually create a sitemap file.

Let's start with the basics.

Basic settings

1. Go to Stores > Configuration > Catalog > XML Sitemap and go through the XML sitemap options.

Magento 2 XML Sitemap Configuration

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

Magento 2 Sitemap Category Options

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

Magento 2 Sitemap Product Options

4. Specify Frequency and Priority for indexing your CMS Pages.

Magento 2 XML Sitemap CMS Pages Options

5. Complete General XML sitemap 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 a notification in case there are some errors while updating a sitemap.
  • 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. to specify whether you'll have one sitemap file or several of them. 

  • Indicate the maximum number of URLs you want to be included in the sitemap in the Maximum No of URLs per File field.
  • Enter the Maximum File Size to set the maximum size of the sitemap file in bytes.

Magento 2 XML Sitemap File Limits

7. Enable the Submissions to Robots.txt option to guide search crawlers on how to index your website better in the robots.txt file.

Magento 2 Sitemap Search Engine Settings

Sitemap generation

Now that you set up sitemap settings, you can create your XML sitemap file.

1. Navigate to Marketing > Seo & Search > Site Map and press the Add Sitemap button.

Magento 2 XML Sitemap Configuration

3. Set the name of the XML file in the Filename field, enter the Path where it should be located and press the Save & Generate button.

Magento 2 XML Sitemap Configuration, New Site Map

Once you finish you'll the generated sitemap in the list of sitemaps. 

Note: a sitemap file is updated automatically by corn according to the generation settings you've set before. Press the Generate button only if you want to update/generate the XML sitemap instantly.

Magento 2 XML Sitemap List


Magento 2 SEO Extension is the all-in-one solution for your Magento SEO needs. It allows you to improve your store positions in SERP, boost ranking, increase traffic, optimize website visibility in search and get...

one-time payment
Buy Now Live Demo

How to Automate Magento Sitemap Generation?

If you've followed this guide from the start, you might have noticed this. You've already set up the auto-generation of the sitemap.

Once you fill out the Generation Settings in the Stores > Configuration > Catalog > XML Sitemap section all you need is to submit the XML file to Google Search Console. Search robots will retrieve all the data from there. 

Magento 2 Sitemap Generation Settings

How to Exclude Some Pages From XML Sitemap?

Although Magento allows you to handle the XML sitemap seamlessly, it doesn't offer an option to disable pages from the sitemap. And that might come in handy if you have some pages that you don't want in search results. 

In that case, you can resort to the Magento 2 XML Sitemap extension, that allows you to exclude pages from sitemap in Magento.

Exclude Pages from XML Sitemap Magento

Magento 2 XML sitemap is a must for those who want to gain organic traffic from search engines. And if you're wondering if the default Magento feature is enough the answer is YES. You can definitely generate an XML sitemap using only the Magento feature.

However, don't forget that indexing is not the only thing you need to tackle to improve SEO. So you also need to have a look at canonical tags, hreflangs, meta tags templates, meta robots and other SEO-related features.