Generate Google Optimized XML Sitemap in Magento 2

Generate Google Optimized XML Sitemap in Magento 2

How to Generate Google SEO Optimized Sitemap.xml for Magento 2?

A sitemap is an important SEO factor. Search engines need it to better understand your website content and intelligently crawl and index it. A sitemap is simply a file containing a list of pages that you want Google and other search engines to index. Although it’s up to the search engine to decide whether or not to index all the pages of a website, a sitemap serves as a guide to your website’s pages for the search engines.

Google recommends sitemap for large websites and websites with rich media content. Since online stores are often large with a lot of rich media content, it’s important for them to have an XML sitemap. The XML sitemap is written for search engines. It also tackles content duplication issues.

In this article, we will see how to generate a Google SEO Optimized XML sitemap for Magento 2. So let’s get started.

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.

Generate Google Optimized Magento 2 XML Sitemap via Extension

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 FMEextensions XML & HTML Sitemap Extension for Magento 2. Let’s see what the features of the extension are and how it helps you in generating a more optimized Magento 2 sitemap.

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

magento-2-xml-sitemap-extension
  • 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.

magento-2-html-extension

You can configure the following settings for the HTML sitemap.

    • Write Meta tags for search engine purposes
    • Enable search field to let customers find items faster.
    • Sort the order of your content