If you’re looking into how to improve your Magento site’s ranking, SEO would be one of the first factors you look at. For SEO, sitemaps are important as they allow search engines or users to easily crawl and prioritize the content your site has. In this article, you’ll learn how to generate XML and HTML sitemaps in Magento 2.
Magento 2 XML Sitemap
Typically, an XML sitemap contains links to help search engines understand your site’s structure, thus indexing it quicker and better. It’s a plain-text file that lists all of the URLs on the Magento site and you’ll submit it to search engines like Google.
The limits for one XML sitemap are no more than 50,000 URLs and should not be over 50MB, or else you need multiple sitemaps to contain all your URLs.
Submitting an XML sitemap will help you in these cases:
- The Magento site is new and only has a few links -> Google may take a while to discover it, which may affect the time your site can make it on the SERPs. An XML sitemap will point them to which content they should crawl first.
- You have a large Magento site with thousands of URLs -> Too many links may confuse the search engines and they won’t know what content should be prioritized, that’s why they need a sitemap.
- Your business operates internationally and the different stores may be posting the same content, just in different languages -> Search engines can use the XML sitemap to provide content in the appropriate language to the audience.
Magento 2 HTML Sitemap
Visitors can find an HTML sitemap on a website’s footer with all the subpages. This is the key difference between an XML and an HTML sitemap since the latter is written to be read by humans.
An HTML sitemap is useful for humans first, and for search engines second.
- With the provided structure of your website, visitors would have much fewer problems with navigation. Thus, they find the products or information quicker, improving the overall experience on your website.
- Asides from being readable by humans, search engines also can use the HTML sitemap to ensure a website’s content is fully crawled. So it’s a good tool that helps search engines like Google to index and provide users better search results.
How to Create Sitemap(s) For Magento 2 Websites
Using Magento 2 built-in feature
Magento 2 has a built-in feature that can generate an XML sitemap, but it’s best that you use it when your store is relatively small and doesn’t have too many URLs.
Follow these steps:
Step 1: Open the Admin panel, choose Marketing > Seo & Search > Site Map
Step 2: Click the Add Sitemap button
Step 3: Fill out
- In the Fieldname, enter the name of the XML map.
- In Path, enter the path where it’ll be located
- Choose Store View
Step 4: Click Save and Generate. Once complete, you’ll see the lists of sitemaps in the grid.
Configure XML sitemap settings
You can configure so that the XML sitemap is updated automatically, here’s how to do it:
Step 1: Go to Admin panel > Stores > Configuration > Catalog > XML Sitemap.
Step 2: The three tabs Categories Options, Products Options, and CMS Pages Options have the same structure. Click to expand and set the Frequency and Priority for each page type.
Step 3: Configure setting for sitemap generation frequency.
- Change to Yes to enable sitemap auto-generation
- Start Time: the server time when the generation begins
- Frequency: set how often the generation will occur
- Error Email Recipient: the email address that will be notified if the generation fails.
- Error Mail Sender: the email that sends the notifications from.
- Error Email Template: how the message will appear to the email recipient.
Step 4: Set Sitemap File Limits
The general rule applied is that an XML sitemap shouldn’t have more than 50,000 URLs and be larger than 50MB. So you can use these numbers for the limits.
Step 5: Under Search Engine Submission Settings, decide how the sitemap is submitted to search engines. Choose “Yes” to Enable Submission to Robots.txt.
Use extension to generate XML and HTML sitemaps
You may realize that the article hasn’t mentioned how to generate an HTML sitemap. It’s because Magento 2 doesn’t support this feature, thus you can’t do it from the backend of Magento like with XML sitemap.
The best solution for this is to leverage a Magento SEO extension from third-party providers. The feature to generate XML and HTML sitemaps is usually included in the offered SEO packages. Configuring sitemap generation with these extensions is quite simple and similar to the steps you’d do with Magento 2’s feature.
Plus, you can take advantage of the extension to carry out some tasks that are impossible with default Magento 2 features such as adding or removing particular links from the sitemaps.
For any website, if they want to achieve a higher ranking with SEO, it’s impossible to miss out on the creation of sitemaps. You can follow the above steps to generate both XML and HTML sitemaps in Magento 2, but note that there are some limitations. In case you want to customize the XML sitemap and need an HTML sitemap for your Magento store as well, an extension may be a better option.
Last but not least, remember to subscribe to our blog if you want to access more valuable Magento tutorials such as How To Fix When Google Shows Wrong Meta Description, How To Set Up Automatic Product Redirects in Magento 2?, or How To Create URL Rewrites in Magento 2?.