Magento 2 Sitemap Setup
It's common knowledge that all the websites compete for visibility in the search engines. The store owners wish to attract new clients and achieve this they need their websites to be crawled by search bots (like Google or Bing) and shown in the results. Sitemaps are just one of the numerous tools to reach this goal.
A sitemap for Magento 2 is an XML file that contains the links to all the pages of the website. Magento 2 websites have hundreds or even thousands of pages so using a Sitemap is essential to help the search bot index the products pages including those that might have been ignored otherwise. Adding images to the sitemap is another feature that is quite important for better Search results as images can bring you more traffic when search bot indexes them.
First of all, you need to create the sitemaps. For this, go to MARKETING ⟶ SEO & Search ⟶ Site Map.
This section contains all the sitemaps generated in your Magento 2 website.
Let’s add the new sitemap. For this, click the Add Sitemap button.
As you can create sitemaps for each Store View separately, you may need to differentiate them. So you can name them in the Filename field. The file can be stored in any existing directory so you can write your own desired Path. Once the sitemap is set up, you can either Save it or Save & Generate it immediately.
After that you can observe the created template in the grid. The generated sitemap URLs can be found in the Link for Google column. The time when the sitemap was generated for the last time is provided in the Last Generated column. You can specify separate sitemaps for different store views. The store view of the sitemap can be observed in the Store View column. Once the sitemap is created you can generate it by clicking the Generate button.
After these initials operations you'll need to setup the sitemaps.
To access your Sitemap configuration page, go to STORES ⟶ Configuration from your admin area.
This opens the default Magento configuration. To setup the XML, open the CATALOG tab and click the XML Sitemap.
The first 3 tabs: Categories Options, Products Options and CMS Pages Options have the similar structure as you need to specify the Frequency and Priority.
Frequency setting adjusts the general information to search bots and may not correlate exactly to how often they really crawl these particular pages. This setting shows mostly how often the page is likely to change. The Always value means that the page content will differ each time they are accessed. The value Never is used for archived URLs like some old blog posts or such. Please note that this is just the proposed value not the mandatory one and it’s always up to the search bot to decide when these pages should be recrawled. We recommend setting at least monthly or weekly for the categories and product pages.
Priority feature is designed to sort the pages on your store according to their importance. Please note that the priority is set according to other URLs on your Magento 2 website. Putting the high priority wouldn’t lead to the changing of the position of your pages in search results pages. The priority is the relative value so putting the highest priority on all the pages wouldn’t help. We recommend playing around the 0.4-0.7 values.
Products Options tab has the possibility to Add Images into Sitemap
The Base Only adds the main image to the sitemap while All will assign all the images. It depends on the number of products and the average number of images per product but it may be quite reasonable to add only the base images due to the sitemaps size limitations.
The Generation Settings provide one of the most important configurations for the sitemap adjustments.
Enabling this section allows to set up the autogeneration of the sitemap and configure the scheduler. Please note that it will work correctly only in case CRON is working correctly. If the autogeneration fails, Magento 2 allows setting up email notifications. Enter your email address in the Error Email Recipient field.
The Sender is set up in GENERAL ⟶ Store Email Addresses
The Email Template can be edited according to this official Magento 2 guide.
The Sitemap File Limits tab manages the Sitemap limitations.
Different search engines declare different rules and limitations. According to the Google rules, it is recommended that Maximum No of URLs Per File is less than 50,000 URLs and Max File Size is not larger than 50MB (52 428 800 bytes).
The Search Engine Submission Settings allow adding the Sitemap directly to Robots.txt
If you enable this feature to add sitemaps to the robots.txt file, they will be listed individually. This automatised operation may be handy for the situations with the multiple store-views.
Following these quite simple steps will dramatically improve your store’s visibility. Search bots can now easily navigate your Magento 2 store and possibly rank it higher. This will, in turn, attract more clients to your website.
The Magento 2 developers have done considerable work in respect of Search Engine Optimisation. In particular, sitemap generation is a flexible and versatile solution and can be used as-is without any third-party extensions. It covers the most important features and solves the main problems that confront the website owner.