The Drupal XML Sitemap module and Google

Drupal Sitemaps FAQ:How do I create an XML sitemap for my Drupal website?

If you have a Drupal website, and want to create an XML Sitemap for Google, Yahoo, Bing, and other search engines, the Drupal XML Sitemap module is the module you need. Here's what I just did to install this Drupal module it on my OneMansAlaska.com website.

Download and install the Drupal XML Sitemap

Step 1 is to make a backup of your Drupal website and database.

Step 2 is to download and install the Drupal XML Sitemap module. For the first part of the installation, you install this just like any other Drupal module, so I'll skip those details.

Configure the Drupal XML Sitemap module

Step 3 is to configure the Drupal XML Sitemap module. This isn't too tricky, but it's VERY important to know that the nodes from your website are not included in your XML sitemap file by default (I don't know why), so you have to add these manually, as described here:

  • Go to your website's "admin/build/modules" URL.
  • In the XML Sitemap section, click the XML Sitemap checkbox.
  • Click the XML sitemap node checkbox.
  • Click Save Configuration.

Now, look at the XML Sitemap URL for your Drupal website. For instance, if your website is example.com, your Drupal XML Sitemap URL will be:

http://www.example.com/sitemap.xml

Initially this will be very small. That's because cron hasn't run yet. You can either wait for your Drupal cron module to run, or ...

Run cron to populate your Drupal XML Sitemap

What I just did is to "poke" my PoorMansCron Drupal module several times until my Drupal sitemap file was created. You do that by hitting the "cron.php" URL of your website, like this:

http://www.example.com/cron.php

Because the OneMansAlaska website is currently pretty small, I just had to hit this URL several times for it to populate my entire Drupal sitemap. (To hit this URL, just enter it in your browser, then click Refresh several times. Initially it should take at least a few moments to populate, and after a few refreshes it should come back quickly. When it does this, you'll know that PoorMansCron isn't doing anything any more, and your Drupal XML sitemap should be populated.)

You can tell that PoorMansCron is working by going back and looking at your Drupal XML sitemap URL again, like this:

http://www.example.com/sitemap.xml

Your Drupal XML sitemap should now show a bunch of URLs for your website, hopefully all of them. If not, well, I don't know that I can help you much there, but you can go back to the Drupal XML Sitemap module project page, and submit your questions there.

Submit your Drupal XML Sitemap to Google and other search engines

Finally, if you haven't already done so, make sure you submit your new Drupal XML Sitemap to Google and other major search engines. Both Google and Bing have "webmaster" pages where you can submit your website URL and XML sitemap URL, and you should include them there. (Here's the Google Webmaster's URL, and here's the Bing Webmaster's URL.)

Also, you can include a line like this in your website's robot.txt file to let everyone know that you now have an XML sitemap:

Sitemap: http://www.example.com/sitemap.xml

Honestly, I don't know if this helps, but the major search engines do respect your robots.txt settings, and this is part of the robots.txt specification.

Installing the Drupal XML Sitemap module - summary

As mentioned, I just followed these steps to install the Drupal XML Sitemap module on my OneMansAlaska website, which is a Drupal 6.x website, and everything seems to be working fine. (I used the latest XML Sitemap module that corresponds to Drupal 6.x.)

If you have any questions about this Drupal XML Sitemap process, and how it relates to Google and the other search engines, just leave a comment below, and I'll be glad to help if I can.