The XML Sitemap Module

https://www.drupal.org/project/xmlsitemap

Warning: We’ve had some trouble getting the XML Sitemap module to work on some websites. In those cases, we’ve used the Simple XML Sitemap module which works great but lacks some of the robustness: https://www.drupal.org/project/simple_sitemap.

Credits & Thanks

Thank you to:

About the XML Sitemap module

The XML Sitemap module creates an XML sitemap of your content that you can submit to the search engines. An XML sitemap is a specially-formatted summary of each piece of content on your website. You can read more at https://www.sitemaps.org/.

Tip: If you’re running an eCommerce website, this module is of particular importance. We’ve seen catalogs with extensive product listings increase traffic by thousands of visitors per day with a proper XML sitemap.

drupal xml sitemap admin page screenshot

Having an XML sitemap helps your SEO by giving Google a list of the pages that you want them to crawl. While Google can crawl your site without an XML sitemap, bigger and more complex sites confuse the crawler so it could potentially miss pages and even whole sections. If you don’t do this, you will have to manually submit every single page of your site to Google which is ridiculously time-consuming.
 

Install and Enable the XML Sitemap Module

  1. Install the XML Sitemap module on your server. (See this section for more instructions on installing modules.)

    drupal xml sitemap module installation
     
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https://yourDrupalSite.dev/admin/modules.
     
  3. Select the checkbox next to XML sitemap, XML sitemap custom, and XML sitemap engines and click the Install button at the bottom of the page.
     

Permissions

If necessary, give yourself permissions to use the XML Sitemap module.

  1. Click Manage > People > Permissions (Coffee: “perm”) or visit https://yourDrupalSite.dev/admin/people/permissions.

    drupal xml sitemap module permissions screenshot
     
  2. Select the appropriate checkbox for “Administer XML sitemap settings”.
     
  3. OPTIONAL: If you wish for your XML sitemap to include user information, select the appropriate checkbox for “User > View user information”, otherwise go on to the next step.

    drupal xml sitemap view user info screenshot
     
  4. Click the Save permissions button at the bottom of the page.
     

Configure the XML Sitemap module

  1. Click Manage > Configuration > Search and metadata > XML Sitemap, (Coffee: “xml”) then click the Sitemap Entities tab or visit https://yourdrupalsite.com/admin/config/search/smlsitemap/entities/settings

    drupal custom entities settings screenshot
     
  2. Select the checkbox next to each entity you want to show up in Google. You will likely select your Content Types and Taxonomies but you may or may not want to select Comments, User, or other items. If in doubt, include them, as they’re often good content for SEO purposes.
     
  3. Click the Save configuration button at the bottom of the page. After saving, stay on the Sitemap Entities tab and complete in the Configuring Individual Content Type Sitemap Settings section below.
     

Configuring Individual Content Type Sitemap Settings

For each content type you selected on the Sitemap Entities tab, you’ll want to enable their inclusion in the XML Sitemap and weight the content. While not difficult, you’ll want to weight your content differently based upon the type of content.

  1. Click the Configure button next to the first content type. This will display the XML sitemap settings page for that content type.

    drupal article xml sitemap settings screenshot
     
  2. From the Inclusion drop down list, select “Included”. A new set of fields will display.

    drupal article xml sitemap settings screenshot 2
     
  3. Set the Default Priority and Default change frequency drop down lists to the settings specified in the table below for each standard content type.

    Table: Standard Content Type XML Sitemap Settings
     
    Content Type Default priority Default change frequency
    Article 0.8 always
    Blog 0.5 always
    Basic page (if used) 0.8 always
    Tags (all taxonomy terms) 0.5 always
    All other content 0.5 always
     
  4. Click the Save Configuration button at the bottom of the page.
     
  5. Once you are finished each content type configuration, go to the Settings tab. Here you will see the different content types divided into tabs.

    Note: Frontpage is automatically set to a Priority of 1.0 (highest) - you’ll want to leave this as it is.

    drupal xml sitemap weightings
     
  6. Make sure that the Minimum sitemap lifetime is set to “No minimum”.
     
  7. Make sure that the check box next to Include a stylesheet in the sitemaps for humans is selected.
     
  8. Click the Save configuration button at the bottom to save your changes.
     

Building Your XML Sitemap for the First Time

  1. Select the Rebuild tab or go to https://yourDrupalsite.com/admin/config/search/xmlsitemap/rebuild.

    drupal xml sitemap rebuilt screenshot
     
  2. Within the Select which link types you would like to rebuild block, select all items.
     
  3. Make sure the checkbox next to Save and restore any custom inclusions and priority links is selected.
     
  4. Click the Save configuration button. This will generate your sitemap for the first time. Go to https://www.yourwebsite.com/sitemap.xml to see it.

The XML sitemap is automatically updated when Cron runs. That makes it unnecessary to rebuild your sitemap again unless you run into problems.

facebook icon twitter social icon linkedin social icon