How to generate XML and HTML Sitemaps in Magento 2?
There are billions of websites competing for visibility in the search engines. You should leverage different tools to improve your SEO performance. Sitemaps are one of the essential elements which may help you achieve this goal.
In today’s article, we would like to guide you to generate both Magento 2 XML and HTML sitemaps.
Table of contents
- What is a Sitemap in Magento 2?
- Why need a Sitemap in Magento 2?
- How to generate XML and HTML Sitemaps in Magento 2?
What is a Sitemap in Magento 2?
In general, a sitemap is basically a navigational tool that contains links to all located resources on a website. It provides an overview of the site’s structure and content.
For Magento 2 sites, XML and HTML sitemaps are two most popular and critical.
An XML sitemap typically helps search engines understand the site’s structure and index the pages better.
An HTML sitemap supports users to explore the site and find their desired items more effectively.
Magento 2 XML Sitemap
An XML ( Extensible Markup Language) sitemap is a plain-text file that lists all the URLs of your Magento 2 website. It can also include additional metadata on each URL.
An XML sitemap is submitted to search engines like Google, then acts as a guide to tell crawlers of search engines what pages are available on your website and how to reach them.
It is crucial to take note that an XML sitemap cannot list more than 50,000 ULRs and its uncompressed file size cannot be more than 50MB. If your sitemap exceeds either these limits, you need to split your URLs into multiple sitemaps.
Magento 2 HTML Sitemap
An HTML sitemap is an HTML (Hypertext Markup Language) page on which lists all subpages of your website. An HTML sitemap is often placed in the footer of the site and visible for all visitors.
In contrast to an XML sitemap, an HTML sitemap is primarily created for users. It displays your site navigation in an outline text version on one page. It serves as one geographical map for everyone who visits your site, helping them quickly access their needed resources.
An HTML sitemap is essential for any kind of website, especially an eCommerce site as it enables shoppers to find their desired items more quickly.
If you are running an extensive website with thousands of categories and products, listing all existing subpages probably makes your HTML sitemap overloaded and confusing.
In this case, you can choose to restrict your sitemap to only the most critical pages, such as the main categories or the most relevant subpages, or to divide your sitemap into multiple hierarchy levels.
Your HTML sitemap should never contain more than 800 links. And it should always be kept organized, quickly loaded, and user-friendly so that the visitors can use it to navigate the site without any complications.
Why need a Sitemap in Magento 2?
Benefits of an XML Sitemap
To make your website visible on the search result pages when someone types some keywords on these search engines, you have to let search engines know what is available and ready to be crawled on your site.
Search engine crawlers typically find a page by following links from other pages or sites and reading sitemaps.
If your Magento 2 site is new, small, and has few external links to it, search engines might not be able to discover your site. Submitting a sitemap will be an excellent method to let search engine bots know about your website then index it accordingly.
If your Magento store is large with dynamic content and the pages might be isolated or not well-linked to each other, adding a sitemap can ensure that search engines do not miss valuable content.
If your store operates internationally and has the same content page in different languages, an XML sitemap can signal the crawlers with this information. Search engines will use this information to provide users with the correct version of the website.
Google states that they do not guarantee to crawl and index all of the pages of a particular site. Submitting a sitemap with additional information helps Google bots understand what content is more important, then prioritize the crawling process. Eventually, the metadata related to each page in an XML sitemap will help Google crawl and index your content better and faster.
Furthermore, Magento 2 SEO sitemap can also include video and image content. When pages are filled with images of products, your online store will have more chances to achieve higher rankings.
In general, a Magento 2 XML sitemap is a critical component that helps to improve your SEO practices. A well-built and updated XML sitemap substantially increases the chances that your web-pages are crawled and indexed by search engines.
Benefits of an HTML Sitemap
Unlike an XML sitemap that is machine-readable, HTML is specially written for humans.
A Magento 2 HTML sitemap provides shoppers a clear structure of your online store. If you are managing an eCommerce website with thousands of categories and products, adding an HTML sitemap is an ideal approach to give your customers a complete overview of your site and your offers.
When you allow your visitors to navigate your site and find their desired items more easily and quickly, you will get better user experience and definitely better conversion rates.
Besides improving user experience, an HTML sitemap also improves the crawling and indexing experience of search engines.
Although an HTML sitemap is primarily created for users, it is also readable by crawlers. As discussed above, Google cannot guarantee that their spiders will index all URLs in the XML sitemap. An HTML sitemap can be another tool to make the site fully crawled.
As Google finds a page from another findable page, Magento 2 HTML sitemap acts as a perfect tool that provides internal links to every page of your store.
How to generate XML and HTML Sitemaps in Magento 2?
Hire Magento Developers
What you need to do is only describing desired features of the Magento website, we will help you to build the store that ticks all the boxes!Get Started
Generate an XML Sitemap in Magento 2 default
In fact, you can generate a sitemap manually if your website is small enough. However, in case your Magento eCommerce site has many categories and products, it is impossible to create a sitemap manually.
Fortunately, Magento 2 provides a built-in feature so you can generate and configure a sitemap in the backend.
To generate a new XML sitemap in Magento 2, follow these steps:
From the Admin Panel, go to Marketing > Seo & Search > Site Map > click on the Add Sitemap button
In the Filename field: Set the name of the XML file In the Path field: Enter the Path where it will be located Choose Store View Press Save and Generate button
Once you have finished, you can see the list of sitemaps in the grid.
You can find the generated sitemap URLs in the Link for Google column.
The last time a sitemap is generated is displayed in the Last Generated column.
You can also create separate sitemaps for different store views. The store view of the sitemap is shown in the Store View column.
You can click on the Generate button to update/generate a sitemap instantly.
A standard Magento 2 XML Sitemap contains links for products, categories, static pages, and product images.
Magento 2 allows you to have XML Sitemap generated automatically by Cron.
From the Admin Panel, please go to Stores > Configuration > Catalog > XML Sitemap
The first three tabs, including Categories Options, Products Options, and CMS Pages Options have the same structure. Under each tab, you need to set the Frequency and Priority for each page type.
Frequency setting shows mostly how often the page is likely to change.
Priority setting aims to signify the importance level of each page.
The Products Options tab has the option to Add Images into the sitemap. You can choose “None” to not add an image to the sitemap, “Base Only” to add only the main photos, “All” to assign all photos. It is recommended to add base images because of the sitemap size limitations.
Under the Generation Setting tab, you will set up and configure the schedule of the sitemap auto-generation here. This feature only works properly if your CRON is working correctly.
Enable: Choose Yes to enable the sitemap auto-generation.
Start Time: The server time when a sitemap is generated. You should set it at night when the load is minimal.
Frequency: How often a sitemap is updated. You can set it daily if your product adding or changing on your site occurs daily.
Error Email Recipient: The email address that receives error notifications if the auto-generation fails.
Error Email Sender: The email address that sends the sitemap generation error notification.
Error Email Template: The message used in the error notification email, you can leave it as default values.
To set the email addresses for these fields, go to Stores > Configuration > General > Store Email Addresses
Under the Sitemap File Limits section, define the sitemap limitations.
Different search engines may have different rules and limitations. Google XML sitemap should not contain more than 50,000 URLs and be larger than 50MB (52,428,800 bytes) These rules are also applied in Magento 2.
In the Search Engine Submission Settings, you will configure how an XML sitemap is submitted to the search engine crawlers.
You can choose “Yes” to Enable Submission to Robots.txt. The sitemap link will be added to robots.txt. Crawlers read this file for getting the site indexation rules.
Related post: How to configure Magento 2 Sitemap
Generating XML and HTML Sitemaps with advanced extension
At present, Magento 2 does not support generating HTML sitemaps. Also, the XML sitemap generation also has some limitations. For example, store owners cannot include or exclude a specific object. This can affect the understanding of Google bots on your site.
To create HTML sitemaps as well as optimize XML sitemaps, you should take advantage of Magento 2 XML, HTML sitemap extension by Mageplaza.
XML and HTML sitemaps are well included in Magento 2 SEO All-in-one package.
Generating an HTML sitemap
This HTML sitemap configuration consists of Categories Sitemap, Pages Sitemap, and Products Sitemap. You can have all of them added in the footer of your page.
Enable HTML Sitemap: choose “Yes” to enable HTML Sitemap. A New HTML sitemap configuration will be expanded automatically.
Enable Categories Sitemap: choose “Yes” to display all category pages.
Enable Pages Sitemap: choose “Yes” to display all pages in the website.
Enable Products Sitemap: choose “Yes” to display all product pages.
Enable Additional Links: if you have a ton of links that can’t be automatically inserted into an HTML file, choose “Yes” to enable this permission.
Additional Links: Paste additional links you want to add.
Add Sitemap Link to Footer: choose “Yes” to enable the advanced HTML Sitemap in the footer of pages.
After finishing these configurations, you will see an advanced HTML sitemap is added to the footer of the page.
When visitors click on the sitemap, they will have an overview of your website. Therefore, they can easily find their desired products.
Optimizing an XML Sitemap
The XML Sitemap’s settings are shown right under the HTML Sitemap’s configuration.
Homepage Optimization: Choose “Yes” to apply, which means that the link of the CMS page using the homepage will be removed in the sitemap file.
Enable Additional Links: For SEO purposes, you may want the crawlers to index the links from another site that have a strong connection to your site. This advanced feature allows you to achieve your goals in a second.
XML and HTML sitemaps are handy tools that any Magento 2 store should have. While an XML sitemap can boost SEO performance, an HTML sitemap can enhance user experience.
We hope that, by this article, you have got a better foundation of sitemaps in Magento 2. And you are ready to add these features into your Magento 2 site.
& Maintenance Services
Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.Get Started
People also searched for
- How to generate XML and HTML Sitemaps in Magento 2?
- 2.2.x, 2.3.x, 2.4.x