Drupal Sitemap Guide

How to create and manage XML sitemaps in Drupal. Covers the Simple XML Sitemap module, configuration options, multilingual support, and common issues.

Drupal does not generate XML sitemaps out of the box, but its module ecosystem makes it straightforward to add one. The most widely used option is the Simple XML Sitemap module, which works with Drupal 9, 10, and 11. This guide covers installation, configuration, and the Drupal-specific considerations that affect how your sitemap works.

For a general overview of XML sitemaps, see our XML sitemap guide.

The Simple XML Sitemap Module

Simple XML Sitemap (formerly "Simple XML sitemap") is the standard module for generating sitemaps in modern Drupal. It replaced the older XML Sitemap module, which was common in Drupal 7 but has been superseded for newer Drupal versions.

Installation

Install via Composer (the recommended way to manage Drupal modules):

composer require drupal/simple_sitemap

Then enable it:

drush en simple_sitemap

Or enable it through the Drupal admin UI: Extend > Search for "Simple XML Sitemap" > Check the box > Install.

Basic Configuration

After installation, navigate to Configuration > Search and metadata > Simple XML Sitemap (/admin/config/search/simplesitemap).

The configuration interface lets you:

  1. Select which entity types to include. Content types, taxonomy terms, user profiles, and any other entity type can be included or excluded.
  2. Set inclusion per content type. For example, include Article nodes but exclude Basic Page nodes.
  3. Configure URL variants. Control whether URLs include language prefixes, www prefixes, and trailing slashes.
  4. Set sitemap variants. Create multiple sitemaps (default, hreflang, custom).

Enabling Sitemaps for Content Types

Go to Structure > Content types > [Your content type] > Edit. Under the "Simple XML Sitemap" vertical tab, you can:

  • Enable or disable sitemap inclusion for this content type
  • Set the default priority (though Google ignores this)
  • Set the default change frequency (also largely ignored by Google)
  • Toggle inclusion of images

These settings serve as defaults. You can override them on individual nodes.

Per-Node Overrides

When editing any node, the Simple XML Sitemap fieldset lets you override the content type defaults. You can exclude specific pages from the sitemap or change their priority. This is useful for pages like "Thank You" pages or temporary landing pages that should not be in the sitemap.

Accessing Your Sitemap

After configuration, your sitemap is available at:

https://yourdomain.com/sitemap.xml

Simple XML Sitemap generates the sitemap dynamically. When Google requests sitemap.xml, Drupal processes the request and returns the current sitemap based on your configuration. The module also supports a sitemap index if your site exceeds 2,000 URLs per sitemap file (configurable).

Sitemap Caching

Generating a sitemap dynamically on every request would be expensive for large sites. Simple XML Sitemap caches the generated XML. The cache is invalidated when you:

  • Publish, update, or unpublish content
  • Change sitemap settings
  • Clear the Drupal cache

You can also manually regenerate the sitemap from the module's admin page or via Drush:

drush simple-sitemap:generate

For large sites, schedule sitemap regeneration during low-traffic periods using a cron job rather than regenerating on every content change.

Custom Paths and Views

Not all URLs in Drupal come from entities. Custom paths, Views pages, and other non-entity URLs need special handling.

Adding Custom Links

In the Simple XML Sitemap settings, there is a "Custom links" section where you can manually add URLs:

/custom-page
/landing/special-offer

These paths are included in the sitemap alongside your entity-based URLs.

Views Pages

If you use Drupal Views to generate listing pages (blog index, product catalogs, search results), these pages are not automatically included in the sitemap because they are not entities. Add them as custom links.

Some Views-generated pages (like paginated archives) should not be in the sitemap. Only include the canonical version of each View page, not every paginated variant.

Multilingual Drupal Sitemaps

Drupal has strong multilingual support, and Simple XML Sitemap handles it well.

Automatic language URL generation

When you have content translated into multiple languages, Simple XML Sitemap automatically includes all language versions in the sitemap. If a node exists in English and French, both URLs appear:

<url>
  <loc>https://example.com/en/page</loc>
  <lastmod>2026-06-09</lastmod>
</url>
<url>
  <loc>https://example.com/fr/page</loc>
  <lastmod>2026-06-09</lastmod>
</url>

Hreflang support

Simple XML Sitemap can add hreflang annotations to your sitemap. Enable this in the module's settings by selecting the hreflang sitemap variant. The output includes xhtml:link elements for each language version:

<url>
  <loc>https://example.com/en/page</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page" />
  <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
  <lastmod>2026-06-09</lastmod>
</url>

This is the recommended way to implement hreflang for Drupal sites with many pages. Adding hreflang link tags to every page's HTML head is also an option (via the Hreflang module), but the sitemap approach scales better. For more on hreflang in sitemaps, see hreflang sitemaps guide.

Untranslated content

If a content item exists in English but has not been translated to French, the French URL will not appear in the sitemap (which is correct). The sitemap only includes URLs for content that actually exists in that language.

Drupal-Specific Sitemap Considerations

Clean URLs

Drupal uses clean URLs by default in modern versions. Make sure your sitemap contains the clean URL version (/about) not the system path (/node/1). Simple XML Sitemap handles this correctly, but if you have custom URL aliasing rules, verify the sitemap output.

Path aliases

Drupal's path alias system lets you create human-readable URLs for content. The sitemap should use the alias, not the system path. Simple XML Sitemap uses aliases by default.

If you change a path alias after content is published, the sitemap updates automatically (after cache rebuild). But the old URL may still be indexed by Google until it is recrawled. Set up 301 redirects from old aliases to new ones using the Redirect module.

Excluded paths

Make sure paths that should not be indexed are excluded from the sitemap:

  • User login and registration pages (/user/login, /user/register)
  • Admin paths (/admin/*) -- these are typically already blocked by permissions
  • Search result pages (/search/*)
  • Taxonomy term pages if they duplicate content shown elsewhere
  • Pagination URLs for Views (unless they have unique, valuable content)

Access control

Simple XML Sitemap respects Drupal's access control. Content that requires authentication to view is automatically excluded from the sitemap. If you have content that is publicly visible but behind a "published" status check, make sure the module only includes published content (it does by default).

Submitting Your Drupal Sitemap

Reference in robots.txt

Drupal generates a default robots.txt file. Add your sitemap reference:

Sitemap: https://example.com/sitemap.xml

In Drupal 10+, you can edit robots.txt through the RobotsTxt module or by placing a custom robots.txt file in your web root. Do not edit the robots.txt in the Drupal codebase directly, as it will be overwritten on updates.

Google Search Console

Submit https://yourdomain.com/sitemap.xml through Google Search Console. See how to submit a sitemap to Google for detailed steps.

Bing Webmaster Tools

Submit the same URL through Bing Webmaster Tools. See how to submit a sitemap to Bing.

Test before submitting

Open your sitemap URL in a browser before submitting it to search engines. Verify it returns valid XML, contains the URLs you expect, and does not include pages that should be excluded. You can also validate it with our sitemap validation guide.

Large Drupal Sites

For sites with tens of thousands of pages, consider these optimizations:

Sitemap index with chunked sitemaps

Simple XML Sitemap automatically splits the sitemap into chunks when the URL count exceeds the configured maximum (default 2,000). It generates a sitemap index at /sitemap.xml that references individual chunk files (/sitemap.xml?page=1, /sitemap.xml?page=2, etc.).

You can adjust the chunk size in the module settings. Google accepts up to 50,000 URLs per sitemap file, but smaller chunks (5,000-10,000) generate faster and are easier to debug.

Separate sitemaps by content type

For very large sites, create separate sitemap variants for different content types. One sitemap for articles, one for products, one for taxonomy terms. This makes it easier to monitor indexing by content type in Google Search Console.

Cron-based generation

For sites with frequent content changes, set up sitemap regeneration via cron rather than on-demand. Add this to your crontab:

drush simple-sitemap:generate

Run it hourly or daily depending on your publishing frequency.

The Old XML Sitemap Module

If you are on Drupal 7, the XML Sitemap module is the standard choice. It works differently from Simple XML Sitemap:

  • Configuration is under Configuration > Search and metadata > XML sitemap
  • It supports content types, taxonomy terms, menus, and users
  • The sitemap is generated as a static file during cron runs
  • It supports sitemap index files for large sites

If you are migrating from Drupal 7 to Drupal 10+, switch from XML Sitemap to Simple XML Sitemap. The configuration approach is different, so plan the migration as part of your site upgrade.

Common Mistakes

Not installing a sitemap module

Drupal does not create a sitemap by default. Without a module, your site has no sitemap. Install Simple XML Sitemap early in your site build.

Including non-canonical URLs

If your site is accessible at both www.example.com and example.com, make sure the sitemap only contains URLs with your canonical domain. Set the base URL correctly in Drupal's settings.

Stale sitemap after major changes

If you restructure your site, delete content, or change URL patterns, regenerate the sitemap. Stale sitemaps that reference deleted content or old URLs send confusing signals to search engines.

Ignoring sitemap errors in Search Console

After submitting your sitemap, monitor Google Search Console for errors. Common issues include URLs returning 404, URLs redirecting, and URLs blocked by robots.txt. Fix these promptly for reliable indexing.

Summary

Drupal requires a module for sitemap generation. Simple XML Sitemap is the standard choice for Drupal 9, 10, and 11. Install it, configure which content types to include, add custom paths if needed, and submit to Google Search Console. For multilingual sites, enable hreflang support in the module settings. Monitor Search Console for errors and regenerate the sitemap after major site changes.

Generate a sitemap for your Drupal site

Crawl your Drupal site and get a ready-to-submit XML sitemap in seconds.

Try Instant Sitemap