Drupal 7 set right settings for xmlsitemap

 Hi! When we use continuous integration and work on multiple environments at once we need to set all our changes itno code. Sometimes features module help us with this, sometimes we need to use update hooks. In case of xmlsitemap module we need to use update hooks. If we need to set priority on content type or delete content type from sitemap.xml file we can use code given below. On picture you can see administration interface of xmlsitemap module yoursite.com/admin/config/search/xmlsitemap/settings.

To set xmlsitemap settings for content type we should follow this path yoursite.com/admin/structure/types/manage/your_content_type

That's all, thank you!

 *Implements hook_update_N();
 * Exclude test content type from sitemap.xml.

function yourmodule_update_7001() {
  // Delete test content type from sitemap.xml settings.
  $settings = array(
    'status' => 0,
    'priority' => 0.5,
  variable_set('xmlsitemap_settings_node_test', $settings);
  //Set right lifetime (recommended one day)
  variable_set('xmlsitemap_minimum_lifetime', 86400);
  // Need to use this value on average and large sites.
  // So if your site doesn't contain 10000 nodes
  // you are able to set 1.
  variable_set('xmlsitemap_prefetch_aliase', 0);