Warning: We’ve had some trouble getting the Drupal 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:
- Darren Oh for creating this module.
- Dave Reid
- Renato Gonçalves H
- The large number of other contributors to this module!
SEO Training Camp
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.
Having an XML sitemap helps your Drupal site's 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
- Install the XML Sitemap module on your server. (See this section for more instructions on installing modules.)
- Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https://yourDrupalSite.dev/admin/modules.
- 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.
If necessary, give yourself permissions to use the XML Sitemap module.
- Click Manage > People > Permissions (Coffee: “perm”) or visit https://yourDrupalSite.dev/admin/people/permissions.
- Select the appropriate checkbox for “Administer XML sitemap settings”.
- 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.
- Click the Save permissions button at the bottom of the page.
Configure the XML Sitemap module
- 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
- 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.
- 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.
- Click the Configure button next to the first content type. This will display the XML sitemap settings page for that content type.
- From the Inclusion drop down list, select “Included”. A new set of fields will display.
- 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
- Click the Save Configuration button at the bottom of the page.
- 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.
- Make sure that the Minimum sitemap lifetime is set to “No minimum”.
- Make sure that the check box next to Include a stylesheet in the sitemaps for humans is selected.
- Click the Save configuration button at the bottom to save your changes.
Building Your XML Sitemap for the First Time
- Select the Rebuild tab or go to https://yourDrupalsite.com/admin/config/search/xmlsitemap/rebuild.
- Within the Select which link types you would like to rebuild block, select all items.
- Make sure the checkbox next to Save and restore any custom inclusions and priority links is selected.
- Click the Save configuration button. This will generate your sitemap for the first time. To see your new Drupal XML sitemap, 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.