By SitemapFixer Team
Updated April 2026

Magento Sitemap: Configuration and Best Practices for Magento 2

Audit your Magento sitemap for errors that block Google indexingCheck My Sitemap Free

Magento 2 Built-in Sitemap Generation

Magento 2 includes a native XML sitemap generator — no third-party extension required for most use cases. The configuration is found in the Magento admin panel at Stores > Configuration > Catalog > XML Sitemap. This section lets you configure frequency, priority, and inclusion settings for each content type: products, categories, and CMS pages.

To generate your sitemap, navigate to Marketing > SEO & Search > Site Map. Click "Add Sitemap" to create a new sitemap configuration. Set the filename (typically sitemap.xml), set the path (typically / for the store root), select the store view, and save. Then click "Generate" to create the sitemap file for the first time. Subsequent generations happen automatically via cron.

Configuring Frequency and Priority per Content Type

In Stores > Configuration > Catalog > XML Sitemap, you have separate settings for Products, Categories, and CMS Pages. For each, you can set:

Frequency: How often the content changes (always, hourly, daily, weekly, monthly, yearly, never). This is a hint to crawlers — set products to "daily" if prices/stock change frequently, categories to "weekly," and CMS pages to "monthly."

Priority: A value from 0.0 to 1.0 indicating relative importance. Set your homepage (or main category) to 1.0, main category pages to 0.8, product pages to 0.7, and CMS pages to 0.5. Priority values only matter relative to other pages on your own site — they don't affect ranking directly.

Also in this section is the Generation Settings area, where you configure the sitemap file size limits and whether to add sitemap links to your robots.txt automatically. Enable the robots.txt option — it ensures all crawlers can find your sitemap without manual robots.txt editing.

Setting Up Cron for Automatic Sitemap Regeneration

Magento 2 uses its own cron system for scheduled tasks. Sitemap regeneration runs via the sitemap_generate cron job. For cron to work, you must have Magento's cron properly configured on your server. The standard setup adds this line to your server's crontab:

# Add to crontab (crontab -e) # Run Magento cron every minute * * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/magento2/var/log/magento.cron.log # Also add the cron:run for the default group * * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run --group="index" 2>&1

You can also configure sitemap generation frequency in the admin under Stores > Configuration > Catalog > XML Sitemap > Generation Settings. Set "Start Time" and "Frequency" (Daily, Weekly, Monthly) to control when the sitemap regenerates. For stores with frequent product updates, daily regeneration is recommended.

Handling Large Catalogs: Sitemap Index Files

Magento 2 automatically splits large sitemaps into multiple files when they exceed the configured size limits. The default limits are 50,000 URLs per file and 10MB per file. When your catalog exceeds these limits, Magento generates a sitemap_index.xml file (or appends an index to your sitemap filename) that references child sitemap files: sitemap.xml, sitemap1.xml, sitemap2.xml, etc.

You can adjust the maximum file size and URL count under Stores > Configuration > Catalog > XML Sitemap > Generation Settings. The maximum URLs per file setting has a hard cap at 50,000 (per the sitemap protocol spec) — don't try to put more than 50,000 URLs in a single file. If your store has 200,000 products, Magento will correctly create 4+ child sitemap files automatically.

Product Images and Multi-Store Sitemap Setup

Magento 2 can include product images in your sitemap using the image extension namespace. Enable this in Stores > Configuration > Catalog > XML Sitemap under the Products section: set "Add Images into Sitemap" to "All," "Base Only," or "None." Including images helps Google discover your product images for Google Images search, which can drive additional traffic for visual products.

For multi-store or multi-website Magento setups, you need a separate sitemap for each store view. Go to Marketing > SEO & Search > Site Map and create one sitemap entry per store view, selecting the appropriate store view for each. Submit each store-specific sitemap to Google Search Console under the corresponding property (one GSC property per domain or subdomain).

Sitemap File Location and Common Errors

Magento stores generated sitemap files in the /pub/ directory by default. If your server is configured correctly, /pub/ is your web root, and your sitemap is accessible at https://yourdomain.com/sitemap.xml. If you see a 404, check that the file exists in /pub/sitemap.xml on your server and that your web server is configured to serve from /pub/.

Common generation errors: file permission issues (the web server user needs write access to /pub/), cron not running (check var/log/cron.log), and PHP memory exhaustion during generation for very large catalogs (increase memory_limit in your PHP configuration or generate via CLI: bin/magento sitemap:generate).

Once your sitemap is accessible, submit it in Google Search Console under Indexing > Sitemaps. Monitor the "Submitted" vs "Indexed" count — a large catalog with thin product pages or extensive duplicate content will show a high submitted/low indexed ratio, which is a content quality signal rather than a sitemap error.

Scan Your Magento Sitemap for Indexing Issues
Free analysis in 60 seconds
Check My Sitemap Free

Related Guides