Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have some special criteria that I want to use to include a node in the xml sitemap. My thinking is that I will set the xmlsitemap settings for the content type to exclude. Then I will use a Rule to trigger on a node's creation and if it passes the conditions then to add a 'execute php code' action which will create the link array and call the xmlsitemap_link_save function.
Should I set the type to 'node' or 'custom'? Will this work, and the link be included in the generated sitemap even if the content types general settings are set to exclude?
Comments
Comment #1
markusa CreditAttribution: markusa commentedTried adding this code to execute in a Rule when new content is created.
$link = xmlsitemap_node_create_link($node);
$link['status'] = 1;
xmlsitemap_link_save($link);
This seems to circumvent the general settings that would exclude that node type from being indexed.
Anyone see any problems that would arise from this strategy?