Install
Works with Drupal: ^8 || ^9Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Changes since 3.4
New features
#3027057: Disable the hreflang method of the language module.
#3090732: Allow adding variants to existing queue without rebuilding it
#3091970: Improve settings UI and tab structure
#3086749: Drush regeneration on a per variant basis
Bug fixes
None.
Improvements
#3090249: Do not remove irrelevant sitemap instances when rebuilding queue
#3094476: PHP 7.4 and Drupal 9 testing deprecation
#3091218: Drupal 9 Compatibility
#3097353: EntityMenuLinkContentUrlGenerator should use MenuLinkTreeInterface
#3098623: Use https when submitting sitemaps to search engines
Changes since 2.x
Ability to create any type of sitemap via plugins
The 8.x-3.x
release allows not only for customizing the URL generation through UrlGenerator plugins as 2.x does, but also creating multiple custom sitemap types through sitemapGenerator plugins and running all the sitemaps on the same Drupal instance. Now e.g a Google news sitemap can be added to a Drupal instance. This is possible through the new concept of sitemap variants.
Ability to create sitemap variants of various sitemap types via UI
Now e.g links form a specific entity bundle can be indexed in a specific sitemap variant with its own URL.
No more out of memory/time errors
The generation process has been streamlined to using a single queue regardless of whether batch generation is being used, or backend (cron/drush) processes. This should allow hundreds of thousands of entities/elements being indexed without memory errors.
If there is a problem, the generation process picks up from the last indexed element. The sitemap variants are only published after the generation has been completed.
Other
- Automatic submission to search engines
- Views and views arguments support
- XSL stylesheets for human visitors
Upgrade path from 2.x
There is an upgrade path from 8.x-2.x for regular users, however the API of the module has undergone several changes and custom code may need adjustments.
API changes since 3.4
There are no breaking changes.
There is a new method Simplesitemap::queue()
that queues variants for generation without deleting the existing queue:
$generator
->setVariants(['default', 'test'])
->queue()
->generateSitemap();
The above would simply queue the new variants on top of the current queue and continue the generation. It does not check if a variant has been queued already, so usually one would use Simplesitemap::rebuildQueue()
instead like so:
$generator
->setVariants(['default', 'test'])
->rebuildQueue()
->generateSitemap();
Simplesitemap::rebuildQueue()
has been altered not to delete sitemap instances the variants of which have not been queued: #3090249: Do not remove irrelevant sitemap instances when rebuilding queue.
Please make sure to use the below simple_sitemap.generator service API instead of accessing the module's configuration storage directly.
API methods
- getSetting
- saveSetting
- setVariants
- getSitemap
- removeSitemap
- queue
- rebuildQueue
- generateSitemap
- enableEntityType
- disableEntityType
- setBundleSettings
- getBundleSettings
- removeBundleSettings
- setEntityInstanceSettings
- getEntityInstanceSettings
- removeEntityInstanceSettings
- bundleIsIndexed
- entityTypeIsEnabled
- addCustomLink
- getCustomLinks
- removeCustomLinks
- getSitemapManager
- getSitemapVariants
- addSitemapVariant
- removeSitemapVariants
- getQueueWorker
- getInitialElementCount
- getProcessedElementCount
- generationInProgress
Hooks
- hook_simple_sitemap_links_alter(&$links, $sitemap_variant)
- hook_simple_sitemap_arbitrary_links_alter(&$arbitrary_links, $sitemap_variant)
- hook_simple_sitemap_attributes_alter(&$attributes, $sitemap_variant)
- hook_simple_sitemap_index_attributes_alter(&$index_attributes, $sitemap_variant)
- hook_simple_sitemap_url_generators_alter(&$url_generators)
- hook_simple_sitemap_sitemap_generators_alter(&$sitemap_generators)
- hook_simple_sitemap_sitemap_types_alter(&$sitemap_types)
Check out this resource for more details about the module and in-depth tutorials.