An XML sitemap is a file that lists a site’s pages and images, making sure search engines (eg. Google, Bing, etc.) can find, understand your site structure, and crawl all your site's pages and images.

When you configure and generate an XML Sitemap in Magento 2, the file (eg. sitemap.xml) will be saved at your Magento 2 installation, in the location that you specify.

When configuring an XML sitemap, you can set the frequency to update the content of each page, and the priority for each type of page (category, product, and CMS pages).

Your XML sitemap should be updated as frequently as the content on your pages (category, product, CMS pages)
changes, which might be daily, weekly, or monthly.

When you generate your Magento 2 ML sitemap, you need to submit it to search engines to make sure search engines bots crawl each of your pages, anytime your XML sitemap is generated.

Follow the steps below to generate and submit your Magento 2 XML Sitemap to search engines.

Step 1: Configure Magento 2 XML Sitemap

Before you generate your Magento 2 XML sitemap, you need to configure its options first, to determine what is included, and how frequently the XML sitemap is updated.

Learn How To Configure Magento 2 XML Sitemap

Step 2: Generate Magento 2 XML Sitemap

Log in to the admin panel, and go to Marketing > SEO & Search > Site Map.

The XML sitemap grid will appear empty if you have not yet generated an XML sitemap

Click Add Site Map

Magento 2 XML Sitemap grid


Configure the sitemap and save.

a) For Single Site

  • Filename: enter the XML sitemap file, eg. sitemap.xml or my_sitemap.xml
  • Path: enter the path of the XML sitemap location in the server. Make sure that the path is writeable. For example: if you enter "/sitemap/": the sitemap.xml file will be generated in a directory called sitemap under your Magento 2 root directory. If you enter "/": the sitemap.xml file will be generated in your Magento 2 root directory.
  • Click Save & Generate.

Magento 2 XML Sitemap edit

The single XML sitemap will be generated, and display in the grid.

Sitemap URL: http://www.mysite.com/sitemap/sitemap.xml

Magento 2 XML Sitemap generated

XML Sitemap Grid Column Description:

  • ID: the unique number of the XML site map.
  • Filename: The filename of the XML site map.
  • Path: The location where the XML sitemap resides in your Magento 2 root directory: /sitemap/ or /
  • Link for Google: The URL of the XML site map that is to be submitted to Google and other search engines.
  • Last Generated: the date and time the XML site map were last generated.
  • Store View: The store view where the XML sitemap applies.
  • Action:  to regenerates the XML site map via the Generate link

a) For Multiple sites

If you have more than one site (eg. mysite.fr, mysite.de, mysite.nl) in your Magento 2 installation, you can make the process more simple, by creating one XML sitemap that includes URLs for all your verified sites, and saves the sitemaps in a single location at your Magento 2 root directory.

Make sure to verify all your Magento 2 sites (eg. mysite.fr, mysite.de, mysite.nl) in Google Search Console

To create sitemaps for a multi-site instance. eg.mysite.fr, mysite.de, mysite.nl, follow these steps

mysite.fr site

  • Filename: enter the XML sitemap file of first store, eg. sitemap.xml
  • Path : enter /sitemaps/mysite_fr/. Make sure to create /sitemaps/mysite_fr/ in your Magento 2 root directory and make that path writeable.
  • Click Save & Generate.

The XML sitemap for site: mysite.fr will be generated in /sitemaps/mysite_fr/sitemap.xml

Sitemap URL: http://www.mysite.fr/sitemaps/mysite_fr/sitemap.xml

mysite.de site

  • Filename: enter the XML sitemap file of second store, eg. sitemap.xml
  • Path : enter /sitemaps/mysite_de/. Make sure to create /sitemaps/mysite_de/ in your Magento 2 root directory and make that path writeable.
  • Click Save & Generate.

The XML sitemap for site: mysite.de will be generated in /sitemaps/mysite_de/sitemap.xml

Sitemap URL: http://www.mysite.de/sitemaps/mysite_de/sitemap.xml

mysite.nl site

  • Filename: enter the XML sitemap file of third store, eg. sitemap.xml
  • Path : enter /sitemaps/mysite_nl/. Make sure to create /sitemaps/mysite_nl/ in your Magento 2 root directory and make that path writeable.
  • Click Save & Generate.

The XML sitemap for site: mysite.nl will be generated in /sitemaps/mysite_nl/sitemap.xml

Sitemap URL: http://www.mysite.de/sitemaps/mysite_nl/sitemap.xml

Step 3: Submit Magento 2 XML Sitemap To Search Engines

To submit your Magento 2 XML sitemap to search engines, you need to provide the link to your sitemap.xml file.

Each search engine has a different instruction to submit an XML sitemap from their webmaster tool.
the two top search engines where you can submit your XML sitemap are Google and Bing.

Learn How to submit your Magento 2 XML sitemap to Microsoft Bing

Learn How to submit your Magento 2 XML sitemap to Google

Split up or Divide Magento 2 XML Sitemaps

Google search engine recommends listing a single XML sitemap to 50MB (uncompressed) and 50,000 URLs.
If you have a larger XML sitemap or if you want to better organize your XML sitemaps per page (categories, productS, CMS Pages, images), you will have to split/divide it into multiple XML sitemaps.

You can create a sitemap_index.xml file that includes a list of each of your sitemaps per page and submits that single index file (sitemap_index.xml) to Google.

Using multiple XML sitemaps in your Magento 2 sites has a lot of benefits such as: minimize crowding of pages in a single sitemap, enhances better online visibility, efficiency groups the content of your sites per sitemap, better organize your pages (category, product, CMS pages) per sitemap, ensure that all pages of your site are crawled and indexed by the search engines, and much more.

Learn Why You Should Use Multiple XML Sitemaps in Magento 2 Site

Conclusion

We hope you find helpful this article about generating XML sitemaps, submitting them to search engines, and using multiple XML sitemaps in Magento 2. Feel free to share this article or leave a comment below. Your opinion is much appreciated!

Tags: xml sitemap splitter for magento 2 sitemap magento-2-marketing-tutorials