How to generate XML and HTML Sitemaps in Magento 2?
Vinh Jacker | 3 days ago
The Most Popular Extension Builder for Magento 2
With a big catalog of 224+ extensions for your online store
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.
What Is A Magento 2 Sitemap?
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 are the two most popular and critical sitemaps.
XML sitemap
Main purpose of using XML sitemap: Help search engines understand the site’s structure and index the pages better.
An XML (Extensible Markup Language) sitemap is a plain-text file that contains a list of all your Magento 2 site’s URLs, along with additional metadata for each URL. This sitemap is submitted to search engines such as Google and guides their crawlers, informing them about the available pages on your website and how to access them.
Pay attention to these limits
- Maximum URL in 1 XML sitemap: 50,000
- Maximum uncompressed file size: 50MB
If your XML sitemap has more than 50,000 URLs and its file size exceeds 50MB, creating many sitemaps would be recommended.
Benefits of XML sitemap
- Improved Visibility: Helps your website appear in search results by informing search engines about available content for crawling.
- Enhanced Discoverability: Assists crawlers in finding your site, especially if it’s new, small, or has few external links.
- Comprehensive Indexing: Ensures that all valuable content on large stores with dynamic pages is indexed by search engines.
- Multilingual Support: Signals to crawlers when the same content is available in multiple languages, helping deliver the correct version to users.
- Priority Content Highlighting: Submitting a sitemap with additional information helps Google prioritize important content for crawling.
- Higher ranking: XML sitemap can include video and image content. Search engines consider websites with videos and images more user-friendly and usually rank them higher.
HTML sitemap
Main purpose of using HTML sitemap: Support users to explore the site and find their desired items more effectively.
An HTML sitemap is a webpage that lists all the subpages of your website, typically found in the footer to make it easy for visitors to access. Unlike an XML sitemap, which is designed for search engines, an HTML sitemap is created for users. It provides a straightforward outline of your site’s navigation, helping visitors quickly find the resources they need.
HTML sitemaps are crucial for any website, particularly e-commerce sites, as they enable shoppers to locate desired items more efficiently. However, for extensive websites with many categories and products, an overloaded HTML sitemap can become confusing. In such cases, you might consider limiting the sitemap to essential pages, like main categories, or organizing it into multiple hierarchy levels.
Ideal HTML sitemap should:
- Have less than 800 links
- Keep it organized, quickly loaded
- Make sure it’s user-friendly
Benefits of HTML sitemap
- User-Friendly Format: Unlike XML sitemaps that are designed for machines, HTML sitemaps are written for human readers, providing a clear structure of your online store.
- Enhanced Site Navigation: For eCommerce websites with thousands of categories and products, an HTML sitemap offers customers a comprehensive overview of your site and its offerings.
- Improved User Experience: By facilitating easier and quicker navigation, an HTML sitemap enhances the overall user experience, leading to higher conversion rates.
- Better Crawling and Indexing: While primarily designed for users, an HTML sitemap is also accessible to search engine crawlers, improving their ability to crawl and index your site.
- Complementary Tool for SEO: Since Google doesn’t guarantee indexing all URLs in the XML sitemap, an HTML sitemap serves as an additional tool to ensure comprehensive site crawling.
- Internal Linking: The Magento 2 HTML sitemap provides internal links to every page of your store, helping search engines discover more pages through findable links.
How to Generate XML and HTML Sitemaps?
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 StartedGenerate 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.
Conclusion
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.