Create a Custom Magento XML Sitemap with PHP

Create a Custom Magento XML Sitemap with PHP

The built-in option for Magento simply takes all the products and makes the sitemap. Which will work for 95% of the stores out there. But if your working on a really custom shop you might want to create your own. This one shop I’m working on has all Configurable Products so I do not want the simple products showing in my sitemap.

I also want to turn off categories like “featured” that I use for sliders and such.

  1. Create File to Overwrite

    Create a file called “my_sitemap.xml” in your root.

  2. Download Script

    You can download the freshest code from our GitHub Gist.

  3. Change Site Source

    Enter Your.com in the Base Variable

  4. Run.

    Make sure your Flat File Index is updated in the Magento Admin. Then, either run it manually when you make a change or set up a cron job.

Jon Tsourakis

Written by:

Jon Tsourakis followed his dream of opening an independent digital marketing agency. As CRO of Oyova Software, he uses logic and intuition to help companies grow their business online.

SUBSCRIBE TO OUR BLOG

Get the tools you need to grow your
business delivered to you weekly.

Enter your email address below: