diff --git a/modules/quant_sitemap/src/SitemapManager.php b/modules/quant_sitemap/src/SitemapManager.php index 6d29287b..b0277679 100644 --- a/modules/quant_sitemap/src/SitemapManager.php +++ b/modules/quant_sitemap/src/SitemapManager.php @@ -164,13 +164,27 @@ protected function getSitemapManager() { * A list of sitemap items. */ protected function getSimpleSitemaps() : array { - $items = ['/sitemap.xml', '/sitemap_generator/default/sitemap.xsl']; - foreach ($this->getSitemapManager()->getAllBundleSettings() as $variant => $def) { - if ($variant == "default") { - continue; + + // Gather XML and XSL files. + $items = []; + foreach ($this->getSitemapManager()->getSitemaps() as $id => $sitemap) { + + // Only add enabled sitemaps with content. + if ($sitemap->isEnabled() && $sitemap->contentStatus()) { + + // Note, creating an options array with 'absolute' => FALSE does not + // generate a relative URL, so we have to extract it. + $items[] = parse_url($sitemap->toUrl()->toString())['path']; + + // Figure out the XSL file for this sitemap. + $pluginId = $sitemap->getType()->getSitemapGenerator()->getPluginId(); + $items[] = '/sitemap_generator/' . $pluginId . '/sitemap.xsl'; } - $items[] = "/$variant/sitemap.xml"; } + + // Remove duplicate XSL files. + $items = array_unique($items); + return $items; } diff --git a/src/Commands/QuantDrushCommands.php b/src/Commands/QuantDrushCommands.php index fbc4714d..a487a864 100644 --- a/src/Commands/QuantDrushCommands.php +++ b/src/Commands/QuantDrushCommands.php @@ -180,6 +180,7 @@ public function prepare($options = ['reset' => 'true']) { 'file_paths', 'file_paths_textarea', 'robots', + 'export_sitemap', 'lunr', ];