Generate Google Optimized XML Sitemap in Magento 2

As the title indicates, this article will discuss everything there is to know about Magento 2 generate XML sitemap. Before we discuss the steps, we need to understand what a sitemap and its importance is.

What is a Magento 2 Sitemap?

The simplest way to describe a sitemap is that it contains all the URLs of your website. The idea of a sitemap is to describe the site’s structure, thereby making it easier for web crawlers to index your website. Sitemaps can be further divided into two types:

XML

This contains information about all the URLs within the website and accompanying metadata. The metadata includes information regarding the webpage’s importance, when it was last updated, and relationship with other webpages.

HTML

This sitemap is made specifically for the users. It provides an overview of the various pages on the website, making it easier for visitors to navigate your Magento 2 store.

XML Sitemap vs HTML Sitemap

The primary difference between the two is that the XML sitemap is created specifically for the web crawlers. WithThis contains information about all the URLs within the website and accompanying metadata. The metadata includes information regarding the webpage’s importance, when it was last updated, and relationship with other webpages.

out an XML sitemap, indexing your website can prove to be a challenge. On the other hand, HTML sitemap is created for the users such as visitors. Not having it won’t impact the indexing or online visibility. Nevertheless, it is recommended to have it since it can improve the user experience and internal linking.

Importance of XML Sitemap Magento 2

Faster Updates

Naturally, eCommerce store owners regularly update the content and other information related to reflect the latest requirements. An XML sitemap in Magento 2 will help the crawler detect the latest changes quickly. In other words, it won’t take long for the latest changes to appear in the search results. Without an XML sitemap, there’s no guarantee when and if the changes will appear.

Recommended for Large Websites

eCommerce stores are considered large websites. Therefore, it is up the store owner to effectively manage which pages the crawler should index. If there’s no XML sitemap, it will lead to inefficient should of the crawl budget. According to Google, the crawl budget or limit is defined as,

“The maximum number of simultaneous parallel connections that Googlebot can use to crawl a site, as well as the time delay between fetches.”

Content Prioritisation

Magento 2 store owners can determine which pages to index, or which pages are top priority. This is done by tweaking the metadata like priority and change frequency. Therefore, you can easily focus on the most important webpages and ensure they rank higher.

How to Configure an XML Sitemap in Magento 2?

To create and configure an XML sitemap for your Magento 2, log in to your website’s admin and navigate to Stores -> Configuration.

Magento-2-xml-sitemap

On the following page, select Catalog -> XML Sitemap.

Magento-2-sitemap-configuration

For a Google-optimized sitemap, it’s important to configure all the options properly. First, let’s see what these options are and how to configure them one by one.

Frequency and Priority of Categories, Products & CMS Pages.

Ideally, the sitemap should be indexed as soon as you update your content. The configuration lets you set the frequency and priority for each type of content.

Categories Options

Uncheck the Use System Value checkbox to be able to customize the options.

In the Frequency dropdown, set the option according to the frequency with which you update your inventory/catalog. For example, if you upload products daily, you should set it to Daily. Setting it to Daily or Weekly is recommended. In the Priority field, enter a value between 0.0 and 1.0. Zero has the lowest priority.

Products Options

Magento-2-sitemap-categories-options

Under Product Options, set the Frequency & Priority of the products as needed. You can also determine the extent to which product images are added into the site by setting ‘Add Images to Sitemap’ to either None, Base only or All.

magento-2-sitemap-product-options

Similarly, expand the CMS Pages Options and set the Frequency & Priority of the CMS Pages according to your preferences.

Generation Settings:

Expand the generation settings and do the following.

  • Set Enabled to Yes.
  • Set the Start Time to the hour, minute and second that you want the sitemap to be updated. 00:00:00 means midnight.
  • Set the Frequency to either Daily, Weekly or Monthly according to your preference.
  • In the Error Email Recipient field, enter the email address of the person who is to receive a notification if an error occurs during a sitemap update.
  • Set Error Email Sender to the person who appears as the sender of the error notification.
  • Set Error Email Template to the template used for the error notification.
magento-2-sitemap-generation-settings

Sitemap File Limits

In the Maximum No of URLs per File field, enter the maximum number of URLs that can be included in the sitemap. By default, the limit is 50,000.

In the Maximum File Size field, enter the largest size in bytes that is allocated for the sitemap. The default size is 10,485,760 bytes.

magento-2-sitemap-file-limits

Search Engine Submission Settings

If you are using a robots.txt file to instruct search engines how to crawl your site, set Enable Submission to Robots.txt to Yes.

When you are done with all these settings. Click Save Config.

Magento 2 Generate Sitemap with Extension

Unfortunately, the default Magento 2 sitemap settings are somewhat limited as it does not allow you to generate an HTML site map and more than one XML sitemaps. Also, you can’t include/exclude links in the sitemap, etc. All these limitations are covered by the FME Extensions XML & HTML Sitemap Extension for Magento 2. It is undoubtedly one of the best Magento sitemap generator, offering features such as:

Create Multiple XML Sitemaps

The extension allows creating multiple XML sitemaps to get thousands of URLs indexed. It also offers more features such as including images titles and include additional links etc.

xml-sitemap-magento-2

Include/Exclude Links from the Magento 2 XML Sitemap

The extension lets you include or exclude links to the Magento 2 XML sitemap to show only the relevant content to search engines.

Create Magento 2 HTML Sitemap

The extension offers a bonus feature to create an HTML sitemap to improve the user experience of the store.

xml-sitemap-magento-2

You can configure the following settings for the HTML sitemap.

This blog was created with FME's SEO-friendly blog