Generate XML sitemap in Magento 2.X
Last week we wrote about importance of robots.txt and how you can easily create one from backoffice of your Magento OS 2.X webshop. You can read the full article here.
Adding an XML sitemap is another common SEO practise that alot of new webshop owners miss. Sitemaps are very important if you want search engines to index your website correctly and efficiently.
In simple words, a sitemap is a list or map of all pages available in a website. You will commonly find two types of sitemaps on websites:
1. XML sitemap: This is a structured listing (in XML format) created for web crawlers of search engines.
You can also manually submit your XML sitemap to search engines. This makes it easier for them to crawl and index your webshop.
2. HTMLsitemap: These is a page containing an orderly list of all pages/sections in your webshop.
It is created for convenience of human visitors of your site. It can help them navigate through the hierarchy of pages/sections on your site comfortably.
Magento has an inbuilt feature using which you can easily add an XML sitemap to your webshop. Today, we will be discussing that XML sitemap feature of Magento OS 2.X.
To create/add a sitemap, login to your Magento OS 2.X admin area and go to Marketing > SEO & Search > Site Map > Click on 'Add Sitemap' button present in top right corner.
You will see a page that will look like this:
here will be three fields:
Filename: You can enter a name for your sitemap file here. It can be anything but should be .xml. Most commonly used name is 'sitemap.xml'
Path: This is the path in your Magento root where the sitemap XML file will be saved. This path should be writeable by apache user, otherwise the XML file will not get saved there.
Store View: You can select the Magento store-view for which you are generating the sitemap. If your store-views have different domains or url-structure then each store-view should have its own sitemap.
Once you populate these 3 things, you can
click on 'Save' button.
You will get a notification that your sitemap is saved and your sitemap XML is generated. The grid will tell you your sitemap file name, sitemap urls, their
store-views and time stamp of their last generation instance.
This is all you need to do to generate an XML sitemap in your Magento OS 2.X webshop.
Just generating and saving the sitemap is not enough though. It is also important to keep the sitemap updated with latest links.
You can manage that from Magento admin > Stores > Settings > Configuration > Catalog > XML sitemap
Your sitemap will have urls of all your product categories, product pages and CMS pages. You can manage all that from this section.
For example, if you do not update/change your Category urls too often then you can set them to be refreshed less frequently.
If you add alot of products or CMS pages frequently then you can make that part of sitemap XML refresh more often.
The frequency of generation/refreshing the XML sitemap file itself can also be controlled from the 'Generation Settings' block. Make sure that you have selected Enabled = Yes.
You can keep start time as midnight and frequency as daily.
You can also enter your email id if you want to receive email notification of any errors issues that Magento faced while generating your sitemap file.
Don't forget to submit the XML sitemap to various Search engines. You can read more about it here.
Feel free to contact Hungersoft for all your SEO or Magento 2.x related queries or requirements.