How to Exclude Pages from XML Sitemap in Magento 2?

An XML sitemap is an important aspect of technical SEO that serves as a roadmap for search robots. Having an XML sitemap ensures search robots don't miss any important pages of your store and can index the newest of them faster. 

Generally, it is a file with all links to your website: products, categories, CMS, and blog pages. However, usually, you don't have to display all of the pages in the search, correspondingly not all of them have to be crawled and indexed. 

While you can add the directives for search robots in the robots.txt file, it is easier just to exclude pages from the XML sitemap in Magento 2.

So, in this article, you will learn how to do this from the admin panel, with no technical configurations required. All you need is the Magento 2 XML Sitemap Extension.

To exclude pages from Magento XML sitemap: 

1. Choose what pages you want to remove from XML sitemap. 

Note: Magefan XML Sitemap Extension allows you to remove any product, category, CMS, or Magefan Blog pages from the sitemap.

Let's exclude the Customer Service page from our XML sitemap.

Remove CMS Page from Sitemap Magento

2. Go to Content > Elements > Pages and find the CMS page you want to remove from the sitemap.

3. Scroll down to the Search Engine Optimization section and enable the

Exclude Pages from XML Sitemap Magento

Don't forget to Save the page and check whether it appears in the sitemap. 

You can try to exclude pages from the XML sitemap on our live demo and check the sitemap. The Search Engine Optimization section on all of the pages.

Removing links from the Magento sitemap with this extension is much easier. Besides, if you also have an HTML sitemap, Magento 2 HTML Sitemap Extension will allow you to exclude pages from it as well.