Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I create several nodes in my manifest and there are a few that I don't want in my sitemap.
I could not find a function that worked for me so I wrote the following function:
function _exclude_from_sitemap($nid) {
return db_update('xmlsitemap')
->fields(array(
'status' => 0,
'status_override' => 1,
))
->condition('loc', 'node/'.$nid)
->execute();
}
Is there another (better) way?
Comments
Comment #1
ngocketit CreditAttribution: ngocketit commentedThis may also work:
Comment #2
Aritra Banerjee CreditAttribution: Aritra Banerjee as a volunteer and commentedHi folks, better hook for removing element without db query is hook_xmlsitemap_link_alter. I am providing one sample code where element is removed by checking the node id.
Comment #3
renatogHi guys.
Thank you very much for your examples @ngocketit and @aritra-banerjee.
It's ok.
Good Work and Good Week.
Regards.
Comment #4
renatogComment #6
SKAUGHT+1