How to Create an XML Sitemap in Magento 2
An XML sitemap plays an important role in improving the visibility of your website in search engines. It provides a structured list of URLs that helps search engines understand and crawl your store more efficiently.
Magento 2 includes a built-in feature that allows store owners to create an XML sitemap directly from the admin panel. Once configured, the sitemap can be automatically generated and updated for search engines.
In this guide, we’ll walk through how to create a Magento 2 XML sitemap, configure its settings, and generate it from the admin dashboard.
What Is an XML Sitemap in Magento 2?
An XML sitemap is a file that contains a list of important pages on your website. It helps search engines discover and index URLs more efficiently. When a sitemap is submitted to search engines, it provides clear information about which pages should be crawled and how frequently they change.
For Magento stores with large catalogs, XML sitemaps are especially useful because they help search engines locate product pages, category pages, and CMS pages faster.
Steps To Create an XML Sitemap in Magento 2
Step 1: Configure XML Sitemap Settings
Before generating a sitemap, you should configure the basic settings in Magento.
Log in to the Magento Admin panel and navigate to:
Stores → Configuration → Catalog → XML Sitemap

Here you will find several configuration sections that control how the sitemap is generated.
Categories Options
In this section, configure how category pages appear in the sitemap.

Important fields include:
- Frequency – defines how often category pages are likely to change
- Priority – determines the importance of category pages compared to other URLs
You can set the priority value between 0.0 and 1.0.
Product Options
Next, configure the settings for product pages.

These options include:
- Frequency – how often product pages are updated
- Priority – relative importance of product URLs
- Add Images to Sitemap – choose whether product images should be included
Including images in the sitemap can help search engines understand product content better.
CMS Pages Options
Magento also allows CMS pages to be included in the XML sitemap.

Similar to the previous sections, you can define:
- change frequency
- priority value
After configuring these settings, click Save Config to apply the changes.
These settings control how Magento structures the sitemap file and how search engines interpret the URLs.
Step 2: Configure Sitemap Generation Settings
Magento can generate the sitemap automatically at scheduled intervals.
In the same XML Sitemap configuration page, locate the Generation Settings section.

Here you can configure:
- Enabled – set this option to Yes
- Start Time – the time when the sitemap generation process starts
- Frequency – how often Magento generates the sitemap (daily, weekly, or monthly)
Automatic generation ensures your sitemap stays updated whenever products or pages change.
Step 3: Generate the XML Sitemap
After finishing the configuration, you can generate the sitemap file from the admin panel.
Navigate to:
Marketing → SEO & Search → Site Map
Then follow these steps:
- Click Add Sitemap
- Enter a File Name (for example:
sitemap.xml) - Specify the Path where the sitemap file should be saved
- Select the Store View if your Magento store uses multiple store views
- Click Save
After saving, click the Generate option to create the sitemap file.
Magento will generate the sitemap and display it in the sitemap grid along with the generation status.
Where Is the Magento 2 Sitemap Stored?
Once generated, the sitemap file is stored on the server.
Depending on your server configuration, the file may appear in:
/sitemap.xml
or
/pub/sitemap.xml
You can also locate the file through your hosting file manager or SSH access if needed.
Final Thoughts
Creating an XML sitemap in Magento 2 is a simple but essential step for improving your store’s SEO.
With Magento’s built-in tools, you can easily configure sitemap settings, generate the sitemap file, and keep it updated automatically. This helps search engines crawl your website more efficiently and index important pages faster.
If you want your Magento store to achieve better search visibility, setting up an XML sitemap is a great place to start.
You may also be interested in our guides on migrating from Luma to Hyvä in Magento 2 and Hyvä theme architecture in Magento 2.