Setting up an XML Sitemap in Drupal

Old map of the USA

Google and the other search engine crawlers do a decent job of finding their way around your website. But, sometimes they could use a little help, as well as to understand the relative importance of your web pages and how often they are updated.

This can be done with an XML Sitemap. And of course, there is a very popular Drupal contrib module for it - aptly named, XML Sitemap. Installation is easy, but you will need to configure a few things before it starts doing its magic. We will look at the Drupal 7 version. And as always, it's good to have a site and database backup before you start. We are using the currently released version- 7.20.

So, after installing the module in one of the usual ways, a new section in /admin/modules will appear - navigate down toward the bottom :

Enable XML sitemap, XML sitemap engines, and XML sitemap node (as shown above). And Save.

Now we need to prepare our content to be added to our XML sitemap. Edit the structure of each content type you want added to the sitemap (such as a Basic page - admin/structure/types/manage/page), then click on the XML Sitemap vertical tab near the bottom left. Then under Inclusion, select Included. For most pages you can leave the default priority as is, or change it for frequently or infrequently updated pages. Then click Save. Do the same for any other Content Types you wish to include.

Drupal configuration screen to include content in an XML Sitemap

When the XML sitemap module was first installed, it will have created a default (but empty) XML sitemap. Next we need to rebuild it so it will pick up all the new pages we configured the Content Types to include. Navigate to /admin/config/search/xmlsitemap

Click on the Rebuild Links tab, then when it changes, click on the Rebuild sitemap button (even though it may tell you that you don't need to). When done, you should see some numbers shown under Links and Pages. See if this is about right for your site. You can view more details on pages in your sitemap and priorities under the Settings tab.

The only thing left to do is tell it to submit your new sitemap to the search engines. Click on Search Engines and check Google and Bing. Save. Done! Wait a day and check on your Google Webmaster Tools account that it is receiving your XML Sitemap. You don't use Webmaster Tools !? You should! It's free and packed full of information from Google on how your site works with its search. Look for an article here soon on how and why. You'll notice the module also suggests you verify your site using the Site Verification module. Good advice! We'll cover that soon too, although it's fairly easy to use.