Hello Magento Friends,

Today’s topic is on How to Remove Some CMS Pages from Sitmap.xml in Magento 2.

Before starting, check out Magento 2 Sitemap (Everything You Need to Know)

Sitemaps are used to help search engines crawl your website pages that are usually overlooked. When you enable sitemap for your website, Magento creates a file named sitemap.xml. There may be a necessity to remove some CMS pages from the sitemap.xml file in Magento 2.

Let’s learn How to Remove Some CMS Pages from Sitmap.xml in Magento 2.

Steps to Remove Some CMS Pages from Sitmap.xml in Magento 2:

Step 1: First of all, create a di.xml file in your module directory

app\code\Vendor\Extension\etc\di.xml

Now add the below code.

Step 2: Create a Sitemap.php file at your module directory

app\code\Vendor\Extension\Model\Sitemap.php

Now add the code as given below

Conclusion:

Hence, this way you can Remove Some CMS Pages from Sitmap.xml in Magento 2. If you face any difficulties, mention them in the comment section, I will be quick to solve them. Share the article further and stay updated with us.

Happy Coding!

Click to rate this post!
[Total: 4 Average: 5]