- π·πΊRussia walkingdexter
Not related to
4.x
, as sitemap types are not plugins.
Derived sitemap type plugins cannot be used. Drupal derived plugins contain colon in the plugin names. For example if you have plugin custom_sitemap_type
and you create a derivative some_derivative
the derivative plugin id is custom_sitemap_type:some_derivative
. Such a plugin cannot be used for sitemap variants because the module creates separate config per variant. However config names cannot contain colons in their names and using such plugin would result into erro:
Drupal\Core\Config\ConfigNameException: Invalid character in Config object name simple_sitemap.variants.frontend_hreflang:site_one. in Drupal\Core\Config\ConfigBase::validateName() (line 107 of core/lib/Drupal/Core/Config/ConfigBase.php).
Motivation for us is that we have a site with 100+ frontends. This is a decoupled site and we need to have a sitemap per frontend. We have introduced a custom sitemap type called frontend_hreflang
. This type derives the sitemap types per frontend, so we don't need to create them manually. It will produce sitemap types like frontend_hreflang:site_one
, frontend_hreflang:site_two
, etc. But we cannot use this due to problem mentioned above.
Create sitemap type derivative, eg:
/**
* Extension of default href lang sitemap type to cover the frontend sitemaps.
*
* @SitemapType(
* id = "frontend_hreflang",
* label = @Translation("Frontend hreflang"),
* description = @Translation("The hreflang sitemap type to cover the frontend sitemaps."),
* deriver = "Drupal\your_module\Plugin\Derivative\FrontendHreflangSitemapType",
* sitemapGenerator = "default",
* urlGenerators = {
* "custom",
* "entity",
* "entity_menu_link_content",
* "arbitrary",
* },
* )
*/
class FrontendHreflangSitemapType extends DefaultHreflangSitemapType {
}
Introduce deriver and create couple of sitemap type plugins. Then try to use deriver sitemap type plugin in your variants under /admin/config/search/simplesitemap/variants
. Eg:
site_one | frontend_hreflang:site_one | site_one.com
Saving the form will result into an error mentioned above.
Would be nice if derived plugins could be used in sitemap variants.
Closed: outdated
4.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Not related to 4.x
, as sitemap types are not plugins.