Create Magento 2 XML sitemap – A Step-by-step Tutorial

by admin

As an owner of a Magento 2 store, you must have read about XML sitemap before. A Magento 2 XML sitemap is an XML file lists all the URLs of a website and additional Metadata about each URL.


This file will be provided to the crawlers of search engines such as Google and Bing. And that’s how the content of your Magento 2 store is read and ranked on the search results.

CHECK OUT Why sitemap is a must-have in Magento 2 for more benefits of XML sitemap

In this article, BSS Commerce will show you step-by-step how to create a Magento 2 XML sitemap in Magento 2.


To start the configuration process, please access Stores => Configuration => Catalog => XML Sitemap.


For the tutorial to be easy to follow, we will divide the settings into 4 main parts: Page Type Options, Generation Settings, Sitemap File Limits, and Search Engine Submission.

1. Magento 2 XML Sitemap: Page Type Options

In general, the default Magento 2 allows admins to set up the Frequency and Priority for the 3 basic page types including Categories, Products, and CMS Pages.


The Frequency setting defines how often the sitemap is updated. There 7 available options: Always, Hourly, Daily, Weekly, Monthly, Yearly and Never. The system value is set at Daily if you do not want to make other changes.


Meanwhile, Priority is a  value between 0.0 and 1.0 that determines the priority of categories/ products/ CMS pages updates in sitemap about other content. 0.0 is considered the lowest value.


Depending on the needs of your store, choose the suitable frequency and priority for each of these page types.


In Product Options, there are one specific configuration name Add Images into Sitemap. This feature of XML Sitemap in Magento 2 enables admins to add product image into XML sitemap. There are 3 options:


– No: Do not add images to the sitemap.


– Base Only: Only add a base image of products into the sitemap.


– All: Add all images of products into the sitemap.

2. Magento 2 XML Sitemap: Generation Settings

For the XML sitemap to be generated automatically, please set the Enabled from “No” to “Yes.”


In Start Time, admins can set the time up to the hour, minute and second for the XML sitemap to be updated in Magento 2.


Frequency setting will affect how often the sitemap will be updated. There are 3 available options: Daily, Weekly, and Monthly.


In case of error happening during an update, the email address at Error Email Recipient will receive a notification email regarding that error.


Thus, admins need to set Error Email Sender to the store contact who will be displayed as the sender of the error email. While Error Email Template needs to be set to the template used for the email.

3. Sitemap File Limits

Following Sitemap protocol for a standard XML sitemap in Magento 2, a sitemap should not be larger than 10MB and contains over 50 thousands links. In the default value of XML sitemap in Magento 2, you can notice that these rules are also applied.


In both Maximum No of URLs Per-File and Maximum File Size, admins can set the value they want. However, the Sitemap protocol should be followed for the best indexing of the search engine crawlers.


You may wonder what will happen if my XML file crosses the limit. In that case, another XML file will be created and continue listing the rest of the links in your store. Thus, there may be multiple XML files in case your store contains a massive number of web pages.

4. Magento 2 XML Sitemap: Search Engine Submission

In the last step of to create XML sitemap in Magento 2, you will set up how the XML sitemap got submitted to the crawlers. If you already set up a robots.txt file, choose Yes in Enable Submission to Robots.txt. This will show the XML sitemap file location in Robots.txt file for the crawler to read.

create-xml-sitemap-in-magento-2-submission5. Advanced Features

Above are all the steps to create as well as all the available features of XML Sitemap for Magento 2. However, you can upgrade them and customize an XML sitemap at a higher level of complexity with Magento 2 XML Sitemap Extension by BSSCommerce.


Let’s check out some of its stunning features that can enhance your XML sitemap.


Split XML sitemap into smaller sitemap.xml files by top-level category, manufacture or time. Remember the case we mention above about the sitemap crosses the limit? By default, Magento 2 will split the sitemap itself. But with the extension, admins can choose how the sitemap will be divided.


Exclude selected links from Magento 2 XML sitemap file by category, product type or product ID. This feature is beneficial if you want to hide some specific links from the crawlers for security reason.


Include additional links to the sitemap. For SEO purpose, admins may want the crawlers to index the links from another site which have a connection to your site. This advanced feature can serve well that purpose


For a more detailed consulting over how XML sitemap supported by extension from BSSCommerce, don’t hesitate to ask our Magento experts! Don’t forget the module comes with FREE INSTALLATION – FREE UPDATE and FREE 1-YEAR SUPPORT.


Don’t forget to check out other Magento 2 extensions by BSS Commerce.


Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.