Simple XML Sitemap
Reference of the module on d.o.
Setup variants
Install using composer
composer require drupal/simple_sitemap
Enable the module either through drush or through UI.
After that navigate to the configuration page for the module (admin/config/search/simplesitemap)
On the “Settings” tab switch to the “Variants” child tab and create a variant
default | default_hreflang | Default
- the first segment is a URL segment - leave blank if you want your sitemap to live in the root of the site /sitemap.xml
and you are not planning to use any other sitemap variants.
If you are submitting your sitemap to third-party SEO services other than Google, identify their requirements to the path of sitemap.
Configure settings
Switch to the “Settings” tab and configure the settings.
Cron settings:
Allow regeneration of the sitemap on cron.
Reduce the interval to a daily - this is optimal amount of time but make sure it is in alignment with the volume of published content on your project. Some projects can have sitemap regenerated less often - some more often.
The bigger is your site the higher are the chances that the sitemap generation will not be finished during one cron run so have the interval bigger helps to eliminate this problem. If sitemap isn’t finished during one cron run then it can finish during the consequent runs.
Language settings:
If your site is multilingual pay attention to the Language settings. Open “Language settings” fieldset and select “Skip non-existent translations” - this will allow to not include non-existent translation into the sitemap.
Keep the checkbox: “Remove hreflang markup in HTML” - unchecked for site that have global audience.
Advanced configuration:
If you have redirects on your site from multiple domains to one, include base URL setting.
Select “Exclude duplicated links” checkbox.
Set amount of links to a reasonable number ~2000 max - your sitemap will be split into a few pages.
Set a sitemap generation time - it influences performance so make sure it’s not too high or too low. 10 is a reasonable starting number.
Multilingual sites setup
Content Translation Redirect module
This module allows to redirect to the default language if translation doesn’t exist.
Default settings
Install using composer
composer require drupal/content_translation_redirect
In the configuration section (admin/config/regional/content-translation-redirect)
Set redirect status to 302. Never set it to 301 unless you know the translation will never exist.
Optionally specify the message for redirection.
You can override the default settings by entity in the Entity Settings tab.
Preprocess hreflang attribute
It’s required to have hreflang attribute per language and region to help Google identify what content needs to be served for visitors in particular geolocation regions. It’s good practice for SEO. Make sure your sitemap includes hreflang alternate for every translation. They can be created using hook_page_attachments_alter
Rabbit Hole
Rabbit hole is a module that allows to avoid bots and users to access nodes and other entities that are not meant to have full page display. The example would be CTA content type nodes used inside views but not necessarily requiring full page display.
Install using composer
composer require drupal/rabbit_hole
Enable Rabbit Hole and Rabbit Hole Nodes, Rabbit Hole Taxonomies, and Rabbit Hole Users.
Configuration for each of these entity types can be found on the content type, user or vocabulary edit pages. Set them to default to Access Denied. These settings can be overridden on each respectful entity form.
The permission allows admins to still have full access to the page views of the rabbit holed entities.
Allows to also create published pages previews for internal review.
Metatag ecosystem
Make sure metatag module is installed. Global option is configured as well as options for content. Add metatag field to the content types to allow editors override keywords and descriptions as needed.
Make sure metatag is setup for views especially if you are using page displays on the site.