Change Default Value of XML sitemap enable/disable flag
-
11-12-2020 - |
Question
Is there a way to change the default value of a node's XML sitemap enable/disable flag for the XML sitemap module?
The default is disabled. I have a large old site that I want to have completely site-mapped by the module. The documentation I can find says I need to edit every node to enable -- there has to be an easier way.
Barring that, is there a Drush command available for it?
Solution
You seem to be asking 2 things.
The default inclusion status for nodes is set on the node type's edit page (admin/structure/types/manage/MYTYPE). The XMLSiteMap settings are stored as xmlsitemap_settings_node_MYTYPE
in keyed array (status
key) if you'd rather drush vset
the setting.
As for bulk inclusion, the xmlsitemap
table stores all items index for inclusion/exclusion in your site map. A drush sqlq command can bulk update these settings.
#Set all XMLSiteMap node entries as included
drush sqlq 'UPDATE xmlsitemap SET `status` = 1 WHERE `type` = "node"'
drush xmlsitemap-rebuild