DEV Community

Elightwalk Technology
Elightwalk Technology

Posted on

How to Add xml sitemap in Magento 2

An XML sitemap is an important part of any website, including those built on Magento 2. Google xml sitemap helps search engines crawl and index your site better and improves the user experience by providing a clear site structure. In this guide, we'll walk you through adding a sitemap to your Magento 2 store, including generating, configuring, customizing, and testing it.

Step 1: Generate the Sitemap XML File

  • Log in to your Magento 2 admin panel.
  • Navigate to Marketing > SEO & Search > Site Map.

Image description

  • Click on the Add Sitemap button.
  • Enter the Filename (sitemap.xml) and the Path (Example, / for the root directory).
  • Click on the Save & Generate button. This will generate the sitemap XML file and save it to the specified path.

Step 2: Configure the Sitemap in the Magento Admin Panel

Image description

  • Go to Stores > Configuration.
  • Under Catalog, select XML Sitemap.
  • Expand the XML Sitemap section.
  • Set the Enabled option to Yes.
  • Enter the path to your sitemap file in the Sitemap File Path field (e.g., /sitemap.xml).
  • Optionally, configure other settings such as the frequency of updates, priority, and limits for the number of links per page.
  • Click on the Save Config button to save your changes.

Step 3: Submit the Sitemap to GSC

Once you've configured and generated the sitemap in Magento 2, you should submit it to search engines like Google, Bing, yahoo, etc. xml sitemap allows search engines to crawl and Indexing more effectively.

  • Open a Google Search Console tool.
  • Add your website property if you still need to do so.
  • Go to the Sitemaps section.
  • Enter the URL of your sitemap (example, https://domain.com/sitemap.xml) and click on the Submit button.
  • Repeat the same process for other search engines if necessary.

You can easily add an XML sitemap to your Magento 2 store
following these steps, which will help search engines effectively crawl and index your site.

Top comments (0)