How to Add Custom Post Type to XML-Sitemap Generator

The Problem

We recently released a new Pro Business Guide named Facebook Fan Pages for Business on our other site. We created a landing page using Premise. Premise allows for the creation of several types of landing pages with some cool features. Read more here.

The Premise landing pages are created as custom post types aptly named “Landing Page” and there are several types of landing pages to choose from. Because these are custom post types, they do not show up in your site feed (which is OK because we don’t want them to at this point), but they also do not show up in our XML Sitemap…and of course we DO want them there so search engines can easily index them and be updated of additions and changes.

We are using the XML-Sitemap Generator plugin (version 3.2.4 at time of writing). This plugin creates and updates your XML Sitemap whenever you add a new page or post BUT it does not account for custom post types.

We did our due diligence and read through the plugin documentation and forum threads, and even found a plugin that hooks into the XML-Sitemap plugin to include custom post types, but decided not to use it because of forward compatibility if the XML-Sitemap plugin gets updated to include custom post types.

The Fix

The solution to adding our custom post types to the XML-Sitemap plugin was simple, thanks to the forward thinking of the plugin developer. He included an option to add pages to the Sitemap manually by entering the URL to the page. It had been awhile since we visited the plugin settings, so we didn’t realize it was so easy right away.

Click to Enlarge

After entering the URL to our Premise custom post type page and configuring a few settings, all we had to do next was use the “Rebuild Sitemap Manually” link to rebuild our Sitemap so it would pick up our manually entered URL.

Click to Enlarge

The Result

You can clearly see in the image below that our Premise custom post type page has been added to our Sitemap.

Click to Enlarge

Update

The solution presented above worked great for our immediate needs, but what if you have dozens or even hundreds of Custom Post Types you need to add to your XML-Sitemap?

1. A function that specifically adds them:
http://www.getupandrunning.net/2010/06/adding-custom-content-types-to-the-sitemap/

2. Using Joost’s SEO plugin for WP which has this feature built-in:
http://yoast.com/wordpress/seo/#xml-sitemap

There is a plugin somewhere that hooks into the XML-Sitemap Generator plugin too, but I can’t seem to find it at the moment.