##  [Drupal 9 XML Sitemap Module](/drupal-9-xml-sitemap-module) 

An XML sitemaps, even though not needed they are recommended. XML sitemaps inform search engines about the structure of your site and other things such as date of last modification, priority, and change frequency. XML sitemap project module adheres to the Sitemap protocol as set out at sitemaps.org. <https://www.sitemaps.org/protocol.html>  
  
XML sitemap module is easy to set up and is very customizable, allowing you to easily include most URLs automatically. The project also comes with two sub-modules; XML Sitemap Custom &amp; XML Sitemap Engines.  
  
XML Sitemap Custom allows you to add custom URL links. These are usually ones that are generated from Views pages such as a directory of product pages, to find these you would need to do a site audit and then add them manually or if you manage your sitemap as you build your site, recommended, add them when created.  
  
XML Sitemap Engines submits your site to search engines. Google and Bing are automatically included but there is also a way to add links to other search engines. Read on to find out how easy it is to configure.

### Info

**Actively maintained** Yes  
**Requires** No extra requirements

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

### Basics

- Enable from the Extend page or using Drush, (see the Install a module page)
- Run cron /admin/config/system/cron
- Visit yoursite/sitemap.xml

> **Drupal Specific Set up**   
> sites/default/files/xmlsitemap needs to be created with correct perms

You will see a basic sitemap with your homepage, you need to configure the module to include other pages on your site.

### To configure

Visit: /admin/config/search/xmlsitemap/settings

Include a stylesheet for humans not needed but is nice when you are building your sitemap.

### Advanced Settings

- Sitemap cache directory - this should automatically be created
- Default base URL needs to be added <https://yoursiteURL.com>
- Enable developer mode to expose additional settings. This is not needed for basic set up.

A sitemap overview of visibility/inclusion will show once you have added content in the next step.

### Add Content Pages to include

#### Custom Entities Settings  
Sitemap Entities Tab

Visit: /admin/config/search/xmlsitemap/entities/settings (in the top tabs)

- Check Content
- Select which content types to include
- Sitemap settings column make sure Configure
- Configure: Inclusion / Default Priority / Default change frequency  
    \*if pages are excluded by default you can add them on the content node edit form.
- Save Configuration
- Run Cron and Visit yoursite/sitemap.xml

There other types of content you can add to your sitemap, check the custom entities page.

Quite some steps, but once your site becomes large it means you can customize to your heart's content.

### Sub Modules

#### **XML Sitemap Custom**

Add page generate from views or other.

Visit: /admin/config/search/xmlsitemap/custom

#### XML Sitemap Engines

Bing or google or custom site map using \[sitemap\] token.

Visit: /admin/config/search/xmlsitemap/engines

You need check which search engines to submit to, and if only to do if the sitemap have been updated since last submission.

### Other Settings

#### Rebuild

This should only be used in emergencies.

Visit: /admin/config/search/xmlsitemap/rebuild

#### Permissions

Like all modules you can grant access to a user based on their role, in the case of a basic site leaving this as default, admin, is good.

### Thoughts

I have used XML Sitemap module since Drupal 6 and it does a great job. There is also Simple Sitemap module which seems to be well-used, with nearly 80,000 sites reporting that they use it, XML Sitemap reports 1/4 million sites. Simple sitemap looks interesting with inclusion of images and also bilingual sitemaps. XML sitemap now has bilingual support for grouped URLs. I haven't tested this yet so will follow up in the coming month with another post to cover Simple Sitemap and how it differs. [https://www.drupal.org/project/simple\_sitemap](https://www.drupal.org/project/simple_sitemap)

#### Troubleshooting

If things aren't set up correctly to start you may get something stuck in cache to start, best to use Rebuild while setting up as it will force the clearing of the cache.



Tags

[Drupal](/drupal)

[SEO](/seo)