After six months of work I'm delighted to tag the first stable release of the 4.x branch of the (Not-so-) Simple XML Sitemap module.
The project is in a really good place right now. At the moment of writing, drupal.org reports it being actively used on around 90k of Drupal 8/9 websites while having 0 open bug reports. This either means you people are lousy bug reporters, or we are doing a descent job at responding. :)
Module rewrite with developers/integrators in mind
4.x makes much greater use of Drupal's entity API dropping some of its very specific chaining API. Feel free to take a look at the roadmap ticket for specifics.
New UI
We now have a much nicer UI for creating, editing and sorting sitemaps as well as sitemap types.
API usage
In a nutshell, sitemap variants are now sitemap entities. These are of a sitemap type (sitemap type entity) that is defined by URL generator plugins as well as sitemap generator plugins.
// Create a new sitemap of the default_hreflang sitemap type. \Drupal\simple_sitemap\Entity\SimpleSitemap::create(['id' => 'test', 'type' => 'default_hreflang', 'label' => 'Test'])->save(); /** @var \Drupal\simple_sitemap\Manager\Generator $generator */ $generator = \Drupal::service('simple_sitemap.generator'); // Set some random settings. if ($generator->getSetting('cron_generate')) { $generator ->saveSetting('generate_duration', 20000) ->saveSetting('base_url', 'https://test'); } // Set an entity type to be indexed. $generator ->entityManager() ->enableEntityType('node') ->setVariants(['default', 'test']) // All following operations will concern these variants. ->setBundleSettings('node', 'page', ['index' => TRUE, 'priority' => 0.5]); // Set a custom link to be indexed. $generator ->customLinkManager() ->remove() // Remove all custom links from all variants. ->setVariants(['test']) // All following operations will concern these variants. ->add('/some/view/page', ['priority' => 0.5]); // Generate the sitemap, but rebuild the queue first in case an old generation is in // progress. $generator ->rebuildQueue() ->generate();
See code documentation and readme for instruction on how to create URL generator and sitemap generator plugins and check out what other things can be done with the API. You are welcome to submit support requests in the matter as well as help improving the documentation.
Should you use this over 3.x?
Yes, read on though.
While the changes of this release are catered towards developers and site builders, I strongly encourage everyone to use the new version, as 3.x will be considered deprecated from now on. All new features and improvements will be coming to 4.x only. Do not panic however, I will be fixing bugs in 3.x for a while.
An update path is provided from previous module versions. Two reasons you might want to postpone upgrading is:
- You depend on the old module's API and need some time to adjust it
- You depend on 3rd party contributed simple_sitemap submodules that are yet to be made compatible with Simple XML Sitemap 4.x. In this case, please open up issues in the respective queues.
To upgrade the module via composer, $ composer require 'drupal/simple_sitemap:^4.0'
can be used. Afterwards, just visit /update.php, or run $ drush updb
to update the module's storage.
Thanks for everyone who has been involved in the development of this tool. Enjoy!
Comments
Congratulations on the release! I've always enjoyed using simple XML sitemap's flexible API - glad to see it's become even more powerful. The update went smoothly on all our deployments. Thanks for this awesome module!
Neuen Kommentar hinzufügen