Magento 2 Sitemap

Magento 2 Sitemap Tutorial on How to Configure a Sitemap, where is the path and how to use in multistore.

Sitemaps » are basicaly the “Google Maps” of a site for the Google Search bot. Here we tell the bot were the pages are located, when they where last updated and how frequently we update each specific page.

Configuration #

  1. Login into the Admin Area.
  2. Hover over Marketing on the left side menu and under SEO & Search, click Site Map.
  3. In the Site Map Page click on Add Sitemap.
  4. On the newly loaded page New Site Map specify:
    • Filename - Here enter the sitemap file: For example: sitemap.xml
    • Path - you can use /sitemap/ or /
    • Store View
  5. Click on Save and Generate

You will have to wait a few minutes depending on the size of your Product Catalog and CMS Pages, once the sitempa is ready you will be redirected to the Site Map page and the Sitemaps gird will show the newly added sitemap.

Settings #

Path #

The Path of the sitemap is a combitation of 2 inputs, Filename + Path when you Configure the sitemap in the backend. https://www.example.com/<Path>/<Filename> So if you have:

  • Filename : sitemap.xml
  • Path - /sitemap/

the URL of this sitemap will be https://www.example.com/sitemap/sitemap.xml.

Cron #

While there is no specific command to trigger only a sitemap generation you can still use the cron:run command and specify the default group, as this one contains the sitemap_generate job:

$ bin/magento cron:run --group default 

This will return if successful:

Ran jobs by schedule.

It is very important to have your Cron setup and running as any updates done to the Product Catalog, Categories or CMS Pages will be added to the Sitemap.xml automatically upon system cron run.

MultiStore #

In a multi-store Magento setup you can speicfy a sitemap for each store view. Steps from Configure can be followed for each store view, making sure at point 3 the Store View is different and the Filename is someting like sitemap_us.xml for a US store view.

Extension #

The extension to generate a Google Sitemap is present out-of-box and available for Configuration.

Errors #

Issues can popup when getting the sitemap or when accessing it. Some of the common issues found are bellow with possible fixes.

Not Generating #

This can happen if the Path specified is not writable. To bypass this you can try and use the /media/ folder as that is writable by default.

404 #

If you are getting a 404 make sure you are using the Link to Google show in the Sitemaps Page grid. If the 404 still gets triggered make sure via FTP that the file is present in the filesystem and is not corrupted, you can download locally and open in your browser.

Published: Jul 1, 2019. Updated: September 10, 2020.


Magento 2 Cache

Magento 2 Cache tutorial on different usage scenarios and why Cache should be enabled on your store.

Read
Magento 2 Maintenance

Magento 2 Maintenance

As a store owner you will need to block the access temporary for Customers in order to update CMS Page, Products or Updating Configuration. This is how you can do it.

Read
Magento 2 Varnish

Magento 2 Varnish

Magento 2 Varnish. What is Varnish and how it can be used and configured in a Magento 2 store.

Read

Magento 2 Theme

Magento 2 Theme Tutorial, what is a theme and how can it be installed, configured or uninstalled in your store

Read

Magento 2 SEO

In this SEO guide we will help you get higher rankings by providing Magento 2 SEO Tips

Read

Magento 2 Indexer

Magento 2 Indexer, what is it and why is it needed in your Magento 2 store and how do you reindex.

Read
Contact
Hire us


Need help with Magento 2 Sitemap ?


Tech

Technologies we work with

Magento is an open-source e-commerce platform written in PHP
PHP is a popular general-purpose scripting language that is especially suited to web development.
MySQL is an open-source relational database management system.
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.
Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs.
Google Tag Manager is a free tool that allows you manage and deploy marketing tags on your website / app
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic
Elasticsearch is a search engine based on the Lucene library.