Generate XML and HTML Sitemaps in Magento 2

How to Generate HTML and XML Sitemaps in Magento 2?

Today, we’re going to teach you guys how to generate HTML and XML sitemaps in Magento 2.

Sitemaps are one of the most essential elements for every website. They help to achieve great visibility in the search engines.

And in this article, we will show you guys how to generate both HTML & XML sitemaps in your Magento 2 store.

What is a Sitemap?

A sitemap is basically a navigation tool containing links to all resources on a website or blog. In simple words, it gives an overview of a website’s structure as well as the content.

And just like any other platform-based websites, Magento 2 websites can generate both HTML & XML sitemaps.

What is HTML Sitemap?

HTML sitemaps basically help users easily explore a website and find the desired content more effectively.

It is generally placed in the footer of the website and displays the entire navigation of your website in an outline text version. In other words, it serves as a geographical map for users and helps them quickly find what they’re looking for.

Now, if you have an extensive website with thousands of pages, products, categories, HTML sitemap will be overloaded and confusing.

So, in this case, you should restrict the sitemap of your website to only the most important pages like main pages, categories and relevant subpages.

And if you’re planning to create an HTML sitemap of your website, make sure that it is neatly-organized, user-friendly, and quickly loaded without any complications.

What is XML Sitemap?

XML Sitemaps help search engines understand a website’s structure and index its web pages better.

An XML-based sitemap is basically a plain-text file that contains all URLs along with additional metadata of each URL.

XML sitemaps are generally submitted to search engines like Google to guide its crawlers what pages are available for indexing and how to reach them on a specific website.

Now, if you’re planning to create an XML sitemap for your website, make sure that it does not contain more than 50,000 URLs and its uncompressed file size does not exceed 50 MB.

Magento 2 Development Services

How to Generate HTML Sitemap in Magento 2

First of all, open the admin panel and go to the Configuration section.

Next, click on the SEO tab from the list.

Now, you’ll see a screen as shown in the screenshot below.

Here, you can create three types of HTML sitemaps:

  • Categories Sitemap
  • Pages Sitemap
  • Products Sitemap

Now, follow the below given steps to generate HTML sitemap for your Magento 2 website.

Select Yes in the Enable HTML Sitemap field.

Select Yes in the Enable Categories Sitemap field to display all category pages.

Select Yes in the Enable Products Sitemap field to display all product pages.

If you have lots of links that cannot be inserted automatically in the HTML file, select Yes in the Enable Additional Links field.

Next, add all your additional links in the Additional Links field.

After that, select Yes in the Add Sitemap Link to Footer field.

Lastly, once you’re done with all these configurations, click on the Save Config button and check the output.

Now, when your website visitors will click on the Sitemap link in the footer of your website, they’ll be able to see the entire overview of your website like below.

How to Generate XML Sitemap in Magento 2

Apart from HTML sitemap, Magento 2 also comes with built-in feature to generate XML sitemap.

To generate a new XML sitemap in Magento 2, follow the below-mentioned steps.

First of all, open the admin panel and navigate to Marketing > Seo & Search > Site Map.

Next, find and click on the Add Sitemap button.

After that, write a name for the XML file in the Filename field.

Then, write a path in the Path field to define where it will be located.

Next, Select a Store View for the XML sitemap and click on the Save and Generate button.

Once you’ve finished the above steps, you can see the list of sitemaps in the grid as shown below.

As you can see in the above screenshot, you can find the sitemap URLs in the Link for the Google column.

Conclusion

That’s about it!

This is how you can generate HTML and XML sitemaps in your Magento 2 store.

We hope that you found this tutorial helpful. If you have any queries, please ask them in the comments below.

And if you need our professional assistance, feel free to contact us anytime.

Tags