By SitemapFixer Team
Updated September 2026

Magento Sitemap: Set Up, Generate and Submit in Magento 2

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

Short answer: Magento 2 has a built-in XML sitemap. Set the options under Stores > Configuration > Catalog > XML Sitemap, then create and generate the file under Marketing > SEO & Search > Site Map. Cron keeps it up to date, and the file is usually served at https://yourdomain.com/sitemap.xml. Create one sitemap per store view.

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).

Priority: A value from 0.0 to 1.0 for relative importance.

Don’t spend long on either. Google’s sitemap documentation says it ignores the <priority> and <changefreq> values; what Google does use is an accurate <lastmod> date and a sitemap that lists only pages worth indexing.

Two more areas on the same page matter. Generation Settings sets the method (Standard or Batch), the start time, how often the sitemap is rebuilt (daily, weekly or monthly) and the file size limits. Search Engine Submission Settings has "Enable Submission to Robots.txt"; set it to Yes so a Sitemap: line is added to robots.txt and every crawler can find the file.

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

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. When a catalog goes over the limits you set, Magento writes several sitemap files plus an index file that lists them, so you still submit a single URL.

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.

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).

Keep Low-Value URLs Out

Large stores grow sitemaps full of URLs that don’t deserve to rank. Check these settings before you submit:

  • Canonical tags. Under Stores > Configuration > Catalog > Catalog > Search Engine Optimization, turn on the canonical link meta tag for categories and products. Each product then declares one main URL, even when it can be reached through several category paths.
  • Child products. Simple products that only exist as options of a configurable product are normally set to "Not Visible Individually", so they have no product page of their own. If yours are visible individually, decide whether each really needs its own page.
  • One sitemap per store view. Each store view gets its own file and its own Search Console property, so language and regional versions don’t get mixed together.

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 (raise memory_limit, or switch Generation Settings to the Batch method). Core Magento generates sitemaps through cron or the Generate link in the admin; some extensions also add a command-line generator.

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 - finds your sitemap and tests 30 URLs live
Check My Sitemap Free

Related Guides