Comprehensive guide on how Magento 2 generates XML sitemaps by default

January 12, 2026

Magento 2 is an enterprise-grade e-commerce platform that recognizes the critical importance of search engine optimization (SEO) from the moment a store is deployed. One of the most fundamental components of this SEO foundation is the XML sitemap. By default, Magento 2 generates XML sitemaps using a built-in sitemap module that automatically collects store URLs and outputs them into a search-engine-friendly XML file. This process ensures that search engine crawlers like Googlebot can discover and index the store's content efficiently.

Built-in XML sitemap functionality in Magento 2

Magento 2 includes a native XML sitemap feature, which is part of the core Magento_Sitemap module. This means that for the vast majority of small to medium-sized businesses, no third-party extension is required for basic SEO needs. The system is designed to generate sitemaps based on store configuration and indexed database data, ensuring that the URLs provided to search engines are accurate and reflect the current state of the catalog.

Key characteristics of the default system

The native Magento sitemap functionality is built around the concept of "Store Scopes." Because Magento is designed to support multi-site and multi-language environments from a single installation, the sitemap generation logic is partitioned accordingly.

One sitemap per store view is the standard behavior. If a merchant operates a "Global" website with "English," "French," and "German" store views, Magento allows for the generation of three distinct XML files. Each file will contain the unique URLs, language codes, and currency formatting relevant to that specific store view.

The generation process can be handled through manual or scheduled generation. Administrators can navigate to the backend and trigger a generation immediately, or they can configure a cron job to automate the process daily, weekly, or monthly. This flexibility ensures that as new products are added, the sitemap remains up to date without requiring constant manual oversight.

Furthermore, the system automatically follows store scope parameters. This includes the base URL, which is vital for stores using subdirectories or different domains for different regions. It also respects the secure/unsecure URL settings, ensuring that search engines are directed to the HTTPS versions of pages.

Configure Magento 2 HTML Sitemap Extension for SEO & UX

URL sources included in the default Magento sitemap

When generating an XML sitemap, Magento 2 pulls URLs from multiple core entities. This ensures that the primary pillars of an e-commerce site—the products, the navigational structure, and the informational content—are all represented.

Products

The product entity is the most complex part of the sitemap. Magento does not simply dump every product into the XML file; it applies several filters to maintain quality. Only enabled products are included; disabled products are ignored to prevent 404 errors for crawlers. Furthermore, a product must be visible in the catalog and/or search. Products set to "Not Visible Individually" (often used for simple products within a configurable product) are excluded by default to avoid duplicate content issues.

Magento also respects product URL rewrites. If a product has a custom URL key or is nested within a specific category path that changes its URL, the sitemap generator queries the url_rewrite table to fetch the finalized, SEO-friendly path rather than the internal system path (like catalog/product/view/id/123).

Categories

The category structure provides the "skeleton" of the site for search engines. Magento includes active categories in the sitemap, provided they are marked to be included in the menu navigation. If a category is created solely for internal grouping and is hidden from the frontend navigation, the default sitemap logic will typically exclude it, assuming it is not a primary landing page for users.

CMS pages

Informational pages—such as "About Us," "Privacy Policy," and "Terms and Conditions"—are crucial for site authority. Magento includes CMS pages that are marked as enabled. However, it intelligently excludes system pages. Pages related to the customer account, checkout, and shopping cart are not included in the XML sitemap because these pages are often blocked by robots.txt and do not contain indexable content of value to a general search user.

Additional links

The homepage is always the primary entry point in the sitemap. Additionally, the store base URLs are included as the root of the hierarchy. Each URL entry in the generated XML follows the standard schema, including:

  • <loc>: The canonical URL of the page.
  • <lastmod>: The last update time, pulled from the updated_at timestamp in the database.
  • <changefreq> and <priority>: These are configurable settings that tell search engines how often a page is likely to change and how important it is relative to other pages on the site.

Magento sitemap generation workflow and configuration setting guides

Magento sitemap generation workflow

The process of turning database rows into a structured XML file involves several technical steps to ensure performance and accuracy.

  • Triggering and data retrieval: The workflow begins when the admin triggers sitemap generation manually or via a cron job. Instead of querying raw entity tables (like catalog_product_entity), which can be slow and taxing on the server for stores with 100,000+ products, Magento queries indexed data tables. By relying on the "Product Prices," "Category Products," and "URL Rewrite" indexes, Magento can compile the necessary URL data much faster.
  • Applying SEO logic: Once the data is retrieved, the system applies URL rewrites. This is a critical step because Magento stores products with multiple possible paths. The sitemap generator ensures that only the canonical version (or the version defined in configuration) is used.
  • XML construction and file system interaction: The XML structure is built following the sitemap.org standards. Magento creates a temporary file and streams the data into it to manage memory usage. This is particularly important for large catalogs where holding the entire XML string in RAM would cause the PHP process to crash.

After the file is fully written, it is saved to the configured server directory. If the file size exceeds 50MB or contains more than 50,000 URLs (the limits defined by Google), Magento is designed to split the sitemap into multiple files and generate a sitemap index file to link them all together. This ensures sitemap generation is efficient and scalable, even for large enterprise catalogs.

Configuration settings that control sitemap generation

Administrators have granular control over how the sitemap is built. These settings are located in the Admin panel under: Stores > Configuration > Catalog > XML Sitemap

Priority and frequency settings

In this section, you can define the "Change Frequency" (e.g., Always, Hourly, Daily, Weekly, Monthly, Yearly, Never) and "Priority" (a value from 0.0 to 1.0) for products, categories, and CMS pages. While modern search engines like Google place less weight on these specific tags than they used to, they remain part of the standard and help search engines understand the site's structure.

File limits and paths

Magento allows you to set the maximum number of URLs per file and the maximum file size. By default, these are set to 50,000 and 10MB to 50MB. You also define the "File Path" and "File Name." For example, if you want the sitemap at the root, you set the path to / and the name to sitemap.xml.

Image sitemap inclusion

One of the standout features of the default Magento 2 sitemap is its ability to include images. Within the product options of the sitemap configuration, you can choose to include all images, only the base image, or none. Including images in the sitemap significantly improves the chances of your product photos appearing in Google Image Search results, which is a major traffic driver for e-commerce.

Automated generation via cron

The "Generation Settings" section allows you to enable scheduled updates. You can specify the start time (usually a low-traffic period like 2:00 AM) and the frequency. You can also provide an email address to receive error notifications if the sitemap generation fails due to file permission issues or database errors.

File storage and access

Once the sitemap is generated, it must be accessible to search engine crawlers.

Server-side storage

By default, generated sitemaps are stored on the server. While the admin can define the path, the standard practice in Magento's modern architecture is to store them under the pub/ directory to ensure they are web-accessible. A common path is: /pub/media/sitemap/

However, most SEO experts recommend placing the sitemap at the root (/sitemap.xml) or using a robots.txt entry to point to the actual path.

Submission to search engines

It is important to note that Magento does not "auto-submit" sitemaps to search engines. The platform generates the file and places it on your server, but the "handshake" with search engines is the merchant's responsibility. You must manually submit the sitemap URL in tools like:

  • Google Search Console
  • Bing Webmaster Tools

By submitting the sitemap URL (e.g., https://www.google.com/search?q=https://www.yourstore.com/sitemap.xml), you provide search engines with a direct map of your site, which speeds up the discovery of new products and updates.

Limitations of Magento 2 default sitemap generation

While the built-in functionality is robust, it is a general-purpose tool and has limitations that might affect high-level SEO strategies.

  • Limited URL filtering: The default generator is binary: a product is either in or out based on visibility and status. There is no native way to exclude products based on specific attributes (e.g., "Exclude all products from brand X" or "Exclude products with a price of 0"). Achieving this level of filtering requires custom code or a third-party module.
  • Custom entities: Magento only supports Products, Categories, and CMS pages out of the box. If your store uses custom entities—such as a "Blog" module, "Lookbook," or "Brand Pages" created by a third-party extension—these URLs will not be included in the default sitemap. Developers must create a "Sitemap Data Provider" in their custom modules to hook into the core sitemap generation process.
  • Basic image support: While it supports images, it does not support advanced image metadata like "Alt" text or "Captions" within the XML schema for all image types. It primarily focuses on the product's base image.
  • Performance on massive catalogs: For stores with millions of URLs, the standard cron-based generation can become a bottleneck. While Magento uses indexed tables, the actual writing of massive XML files can still lead to long execution times and potential timeouts in a standard PHP environment.

When the default Magento sitemap is sufficient

Despite the limitations mentioned, Magento’s native XML sitemap works exceptionally well for the majority of users.

  • Small to medium catalogs: If your store has between 100 and 50,000 products, the default sitemap is more than capable. It will generate quickly, stay within file size limits, and accurately represent your catalog.
  • Standard SEO requirements: If you only need to ensure that your standard product, category, and CMS URLs are indexed, there is no need to complicate your stack with extra extensions. The native module follows all sitemap.org protocols and is recognized by all major search engines.
  • Predictable content schedules: For stores that update their catalog once a day or once a week, the built-in cron scheduler is perfectly adequate. It ensures that the sitemap is refreshed shortly after the catalog updates are completed.

For enterprise-level SEO, multi-regional stores with complex hreflang requirements, or headless integrations, API-based or extension-driven sitemap solutions are usually more appropriate. These solutions can handle the complexities of cross-domain URL mapping and high-frequency updates more effectively.

Summary

Magento 2 generates XML sitemaps by collecting enabled, index-ready URLs and applying SEO-friendly URL rewrites to ensure search engines see the best possible version of a link. By outputting a standards-compliant XML file and allowing for both manual and automated (cron) generation, Magento provides a solid SEO foundation without extra setup.

The workflow is designed to be efficient, leveraging indexed data to minimize server load. While it may lack some advanced filtering features for complex custom entities, its ability to handle multiple store views, include product images, and automatically manage file splitting makes it a highly capable tool for most Magento merchants. Understanding how these settings work allows store owners to ensure their content is always visible to the world's most important search engines.

Scale your Magento store
Actionable Magento SEO knowledge to help your store rank better, get discovered faster, and grow sustainably
Start Now