Why?
Using the default rss.xml provided by Drupal as sitemap is not enough. It only contains all articles that are posted on the front page. Not all articles are suitable for the front page. We need a module for this. There are 2 contenders:
- XML sitemap is an older module and has more features than Simple XML sitemap. Notably, the ability to automatically send sitemap to search engine. However, its Drupal 8 version is still in alpha state.
- Simple XML sitemap is build for Drupal 8 and actively maintained. It is in compliance with Google standard regarding multilingual content.
For the time being, I'm choosing Simple XML sitemap. I need a simple module that is actively maintained and hopefully future proof, Drupal 9(?).
I don't need to send sitemap to search engines. By the time they crawl my site, I have time to revise and update my articles.
For more informations about their differences, see this post.
Setup Simple XML sitemap
After you enable Simple XML sitemap, you now have to select which entities will be generated.
Navigate to Structure > Content Types
. Open the content type that you like to include in the sitemap. Under the Edit tab, on Simple XML site map section, select you desired options.
Below is an example,
You can do the same for Taxonomy.
To check the output, navigate to Configuration > Simple XML Sitemap
. On the Default Variant row, click on the published link.
It will open http://your-domain.com/default/sitemap.xml. The sitemap can also be found at http://your-domain.com/sitemap.xml.