Magento 2 Sitemap Generation Guide
How to generate, configure, and submit XML sitemaps in Magento 2. Covers the built-in sitemap feature, configuration options, large catalog handling, and common issues.
Magento 2 (including Adobe Commerce) has a built-in XML sitemap generator. Unlike many other platforms, you do not need to install a plugin or extension for basic sitemap functionality. The built-in feature handles product pages, category pages, and CMS pages automatically. This guide covers how to set it up, configure it for large catalogs, and avoid common pitfalls.
For a general overview of XML sitemaps, see our XML sitemap guide.
Enabling the Built-In Sitemap Generator
Magento 2's sitemap generator is available in the admin panel under Marketing > SEO & Search > Site Map.
Creating a Sitemap
- Log in to your Magento admin panel
- Navigate to Marketing > SEO & Search > Site Map
- Click "Add Sitemap"
- Enter the filename (typically
sitemap.xml) - Enter the path (typically
/for the root directory) - Click "Save & Generate"
Magento creates the sitemap file at the specified location. For a standard installation, the sitemap is accessible at https://yourdomain.com/sitemap.xml.
Automatic Generation with Cron
For the sitemap to stay current as you add, update, and remove products, configure automatic generation:
- Go to Stores > Configuration > Catalog > XML Sitemap
- Under "Generation Settings":
- Set "Enabled" to "Yes"
- Set "Start Time" to a low-traffic hour (e.g., 3:00 AM)
- Set "Frequency" to "Daily" for active stores
- Set "Error Email Recipient" to receive notifications if generation fails
This requires that Magento's cron system is running. If you have not set up cron jobs for Magento, the automatic generation will not work. Verify cron is running:
crontab -l | grep magento
You should see entries for Magento cron. If not, set them up according to Magento's documentation.
Configuration Options
The sitemap configuration lives at Stores > Configuration > Catalog > XML Sitemap.
Category Options
- Frequency: How often categories change. Default is "Daily." Google largely ignores this, but set it to reflect your actual update pattern.
- Priority: Relative importance of categories. Default is
0.5. Google ignores this tag.
Product Options
- Frequency: Default "Daily." For stores with frequent inventory changes, this is reasonable.
- Priority: Default
1.0. Again, Google ignores this. - Add Images into Sitemap: Options are "None," "Base Only," or "All." "Base Only" includes the main product image. "All" includes all gallery images. Including images helps with Google Image search visibility.
CMS Page Options
- Frequency: Default "Weekly" for static CMS pages.
- Priority: Default
0.25.
Generation Settings
- Enabled: Turns automatic generation on or off
- Start Time: When daily generation runs
- Frequency: Daily, Weekly, or Monthly
- Error Email Recipient and Template: Notifications for failed generation
- Maximum No. of URLs Per File: Default is 50,000 (the protocol maximum). For very large catalogs, Magento automatically splits into multiple files with a sitemap index.
- Maximum File Size: Default is 10,485,760 bytes (10 MB). Magento splits the file if it exceeds this size.
What the Sitemap Includes
By default, Magento's sitemap includes:
Product pages
All enabled, visible products with status "Enabled" and visibility set to "Catalog, Search" or "Catalog" or "Search." Products set to "Not Visible Individually" are excluded.
Product URLs use the URL key you set in the product configuration. Make sure your URL keys are clean, descriptive, and unique.
Category pages
All active categories that are included in the navigation menu. Disabled categories and categories not included in the menu are excluded.
CMS pages
All enabled CMS pages. This includes your homepage, about page, and any other static pages you have created in Content > Pages.
What it does not include
- Out-of-stock products (if "Display Out of Stock Products" is disabled)
- Customer account pages
- Checkout pages
- Search result pages
- Layered navigation / filtered product listing URLs
- Admin pages
The exclusion of filtered URLs is correct behavior. Including every possible filter combination would bloat your sitemap with low-value, duplicate content.
Handling Large Product Catalogs
E-commerce sites often have thousands or tens of thousands of products. Magento handles this through automatic sitemap splitting.
Automatic splitting
When the URL count exceeds the configured maximum (default 50,000) or the file size exceeds the maximum (default 10 MB), Magento creates a sitemap index file that references multiple child sitemaps:
sitemap.xml (index)
├── sitemap-1-1.xml (products 1-50000)
├── sitemap-1-2.xml (products 50001-100000)
└── sitemap-1-3.xml (categories and CMS pages)
This happens automatically. You do not need to configure anything beyond the maximum URL and file size settings.
Performance considerations
For stores with 100,000+ products, sitemap generation can take several minutes and consume significant server resources. Schedule generation during off-peak hours and monitor server load during the process.
If generation is timing out, increase your PHP memory limit and execution time:
memory_limit = 2048M
max_execution_time = 3600
These values should be set in your PHP configuration for the CLI environment (since cron runs Magento's CLI).
Multistore Sitemaps
Magento supports multiple stores (storeviews) from a single installation. Each store needs its own sitemap.
Creating per-store sitemaps
- Switch to the store scope in the admin panel
- Create a separate sitemap for each store
- Use different filenames or paths to avoid conflicts:
- Store 1:
/sitemap.xml - Store 2:
/store2/sitemap.xmlor/sitemap-store2.xml
- Store 1:
Multistore with different domains
If each store uses a different domain (us.example.com, uk.example.com), each sitemap must use URLs from the correct domain. Magento generates URLs based on the store's base URL configuration.
Verify each store's base URL at Stores > Configuration > Web > Base URLs (switch to the appropriate store scope).
Multilingual stores
If you use store views for different languages, create a sitemap per language. For hreflang support, Magento's built-in sitemap does not add hreflang annotations. You will need a third-party extension or a custom solution to add hreflang to your sitemaps. See our hreflang sitemaps guide for the format.
Adding the Sitemap to robots.txt
Magento generates a robots.txt dynamically. Configure it at Content > Design > Configuration > [Your store] > Search Engine Robots.
Add the sitemap reference to the "Custom Instructions" field:
Sitemap: https://example.com/sitemap.xml
Alternatively, if you manage robots.txt as a static file, add the line directly.
Submitting to Search Engines
After generating your sitemap, submit it to Google Search Console and Bing Webmaster Tools.
Google Search Console: Go to Sitemaps in the left menu, enter sitemap.xml, and click Submit. See how to submit a sitemap to Google.
Bing Webmaster Tools: Navigate to Sitemaps, enter the URL, and submit. See how to submit a sitemap to Bing.
After submission, monitor the sitemap status. Google will report any errors it finds, such as URLs returning 404 or URLs blocked by robots.txt.
Check file permissions
Magento needs write permissions to the directory where it generates the sitemap. If generation fails silently, check that the web server user has write access to your Magento root directory (or whichever path you specified). On Linux, this is typically the www-data or apache user.
Third-Party Extensions
While the built-in generator handles most needs, third-party extensions add features:
Amasty XML Sitemap
- Separate sitemaps by entity type (products, categories, CMS, blog)
- Exclude specific products or categories by rule
- Hreflang support for multilingual stores
- Add additional URL types (blog posts from third-party blog extensions)
MageWorx SEO Suite
- Advanced sitemap splitting options
- Cross-links between related sitemaps
- Integration with the MageWorx SEO suite for broader optimization
These are most useful for large, complex stores where the built-in generator's configuration is too limited.
Common Mistakes
Not setting up cron
The most common issue. Without Magento cron running, automatic sitemap generation does not happen. Your sitemap becomes stale as products are added and removed. Verify cron is configured and running.
Including configurable product URLs and simple product URLs
If you sell configurable products (like a t-shirt with size and color options), both the configurable product URL and the individual simple product URLs may appear in the sitemap. Typically, only the configurable product URL should be indexed. Set simple products to "Not Visible Individually" to exclude them from the sitemap.
Forgetting to regenerate after URL rewrites
If you change product URL keys, category URL structures, or enable/disable URL suffixes (.html), regenerate the sitemap. The old URLs in the sitemap will return 404s or redirects, which Google reports as errors.
Not checking the sitemap after Magento upgrades
Major Magento upgrades can affect sitemap generation. After upgrading, verify the sitemap generates correctly, contains the expected URLs, and is accessible at the configured path.
Including staging or development URLs
If you generate the sitemap in a staging environment and deploy it to production, the URLs may still reference the staging domain. Always generate the sitemap in the production environment or verify that the base URL is correct.
Summary
Magento 2 includes a capable XML sitemap generator that handles product, category, and CMS pages. Enable it in Marketing > SEO & Search > Site Map, configure automatic generation with cron, and submit to Google Search Console. For large catalogs, Magento automatically splits into multiple files with a sitemap index. Add hreflang support through a third-party extension if you run multilingual stores.
Generate a sitemap for your store
Crawl your Magento store and get a standards-compliant XML sitemap.
Try Instant Sitemap