Fix Your Sitemap for Drupal
Drupal 9 and 10 sites rely on the Simple XML Sitemap module to generate sitemap.xml. Content type settings, taxonomy term bundles, and language variants determine what gets indexed and what gets buried.
Drupal sitemaps go wrong when content types are enabled by default, when taxonomy pages are exposed without curation, or when Views-generated listings bloat the feed. And unlike WordPress, Drupal doesn't ship a sitemap with core - you pick a module, configure it per-bundle, and remember to regenerate on content changes.
Audited a Drupal 10 publisher last month with 9,200 articles. The sitemap had 31,000 URLs. Breakdown: 9,200 articles (expected), 6,800 taxonomy term pages (mostly empty tag pages), 11,000 "Basic page" nodes that had been used as components inside other pages, and 4,000 Views listing URLs. Turning off everything except Article and Product content types dropped the sitemap to 9,800 URLs overnight.
Simple XML Sitemap vs XML Sitemap
Two modules, similar names:
- Simple XML Sitemap (
drupal/simple_sitemap) - Drupal 9/10 compatible, actively maintained, per-bundle config, multi-variant support. Use this on new sites. - XML Sitemap (
drupal/xmlsitemap) - older, more granular node-level control, but Drupal 10 support has been patchy. Mostly legacy D7 sites still on it.
Common Drupal Sitemap Issues
- Every content type added to the sitemap by default, including Basic pages used as components
- Taxonomy term pages (
/taxonomy/term/42) indexed instead of pathauto aliases - Views pages (admin listings, facet pages) leaking in
- Multilingual nodes emitting duplicate URLs without hreflang
- Anonymous cache returning stale sitemap for hours after regeneration
- Node priority unchanged from 0.5 default - Google ignores it but it's a signal the config was never touched
- Sitemap regenerated only on cron, so fresh content takes up to an hour to appear
- Unpublished nodes leaking because the "Include unpublished" flag got toggled during content editing
Install and configure Simple XML Sitemap
# Install composer require drupal/simple_sitemap drush en simple_sitemap -y # Regenerate drush simple-sitemap:generate # Generate a specific variant only drush simple-sitemap:generate --variants=default # Clear cache so the new sitemap is served drush cr # View counts per URL (sanity check) curl -s https://yoursite.com/sitemap.xml | grep -c '<url>'
Content type filtering and path aliases
Go to /admin/config/search/simplesitemap/entities and enable only the bundles that should be indexable. Typical choices:
- Enable: Article, Product, Landing page, Taxonomy terms with content
- Disable: Basic page (if used as components), Webform submissions, Comments, User profiles
Path aliases: install drupal/pathauto and set patterns for each bundle. Simple XML Sitemap uses the aliased URL if pathauto is active - otherwise it emits /node/123 which is awful for rankings and worse for crawlability.
Multilingual and hreflang
With locale and content_translation enabled, Simple XML Sitemap emits one URL per language variant. To add xhtml:link alternates, enable the hreflang submodule shipped in simple_sitemap. Each translated node then lists all its language alternates inside the same <url> element. Verify in GSC's International Targeting report that alternates are detected without errors.
Step-by-Step Fix Guide
- Install via
composer require drupal/simple_sitemapand enable with drush - At
/admin/config/search/simplesitemap/entities, enable only public-landing-page bundles - Set per-bundle priority and changefreq (Article 0.8 weekly, Term 0.3 monthly, Product 0.7 weekly)
- Install pathauto and configure patterns so entity URLs use aliases
- Under Views, disable sitemap inclusion on admin and internal listings
- For multilingual, enable the hreflang submodule
- Run
drush simple-sitemap:generatethendrush cr - Verify with
curl https://yourdomain.com/sitemap.xmland inspect a few URLs - Submit to Google Search Console