Milind Daraniya

How to Create Magento 2 XML Sitemap? A Step-by-Step Guide

Published September 2nd, 2023 19 min read

An XML sitemap is a crucial element for search engine optimization (SEO) as it helps search engines like Google to discover and index all the important pages of your Magento 2 website. In this step-by-step guide, we'll walk you through the process of creating an XML sitemap for your Magento 2 store to improve your website's search engine visibility and rankings.

Login to Your Magento 2 Admin Panel

Log in to your Magento 2 admin panel using your admin credentials.

Navigate to XML Sitemap Settings

In the admin panel, go to Stores > Configuration > Catalog > XML Sitemap.

Configure XML Sitemap Settings

In the XML Sitemap settings, you can configure various options:

  1. Enable Submission to Robots.txt: Enable this option if you want to automatically add the sitemap path to your robots.txt file.
  2. Enable Sitemap: Ensure that this option is set to "Yes" to enable the XML sitemap.
  3. Frequency: Choose how often your sitemap will be updated. Options include "Always," "Hourly," "Daily," "Weekly," "Monthly," and "Yearly."
  4. Priority: Set the priority of your pages from 0.0 to 1.0. A higher priority indicates more importance.
  5. Error Email Recipient: If you want to receive an email notification in case of sitemap generation errors, enter your email address here.
  6. Error Email Sender: Choose the sender of the error email.
  7. Error Email Template: Select the template for the error email.
  8. Maximum No of URLs Per File: Specify the maximum number of URLs in a single sitemap file.
  9. Add Images into Sitemap: Enable this option if you want to include images in your sitemap.
  10. Base Filename: Set the base filename for your sitemap.
  11. Path: Choose the path where the sitemap will be saved. The default path is /pub/sitemap/.
  12. Store View: Select the store view for which you want to generate the sitemap.

Save Configurations

After configuring the XML Sitemap settings, click on the Save Config button to save your changes.

Generate the XML Sitemap

To generate the XML sitemap, go to Marketing > SEO & Search > Site Map.

Add New Sitemap

Click on the Add Sitemap button to create a new sitemap.

Configure Sitemap Settings

In the sitemap settings, you can configure the following options:

  1. Sitemap Filename: Enter the name of the sitemap file.
  2. Path: Choose the path where the sitemap will be saved.
  3. Store View: Select the store view for which you want to generate the sitemap.
  4. Generate: Click on the Generate button to create the sitemap.

Check the Sitemap

After generating the sitemap, you can check it by accessing the sitemap URL. The default sitemap URL is http://yourdomain.com/pub/sitemap/sitemap.xml.

Submit the Sitemap to Search Engines

Finally, submit your XML sitemap to search engines like Google, Bing, and others. This will help search engines discover and index your website's pages more efficiently.

Creating an XML sitemap for your Magento 2 store is essential for improving search engine visibility and ensuring that all your important pages get indexed properly. By following this step-by-step guide, you can easily generate an XML sitemap and take a significant step towards enhancing your website's SEO.