Question

I use the XML sitemap module (7.x-2.0-beta3) to generate the XML sitemap for my site. The problem is that I cannot set the change frequency of the content types.

In "admin/config/search/xmlsitemap/settings" I have a "Change frequency" combobox, but this is only for the front page.
I have some other content types and taxonomy tags. How can I change the frequency for them?

Was it helpful?

Solution

As far as I can see, the priority form field is added to the content type form from xmlsitemap_add_link_bundle_settings(), which is called by xmlsitemap_node_form_node_type_form_alter().

The first function, in the development snapshot, is using the following form field definitions.

  $form['xmlsitemap']['status'] = array(
    '#type' => 'select',
    '#title' => t('Inclusion'),
    '#options' => xmlsitemap_get_status_options(),
    '#default_value' => $bundle_info['status'],
  );

  $form['xmlsitemap']['priority'] = array(
    '#type' => 'select',
    '#title' => t('Default priority'),
    '#options' => xmlsitemap_get_priority_options(),
    '#default_value' => $bundle_info['priority'],
    '#states' => array(
      'invisible' => array(
        'select[name="xmlsitemap[status]"]' => array('value' => '0'),
      ),
    ),
  );

The form field for the priority is invisible when the "status" field is set to 0.

OTHER TIPS

I was also having trouble with "yearly" and "never" coming up unexpectedly under the <changefreq> tag. This is a separate setting from <priority> - it's a different XML tag and they don't seem to be related based on what you choose for priority.

I wish I found a better solution that did actually allow you to control this setting in the UI per content type. But since this does not seem to exist, I simply disabled changefreq completely:

  • Go to /admin/config/search/xmlsitemap/settings
  • expand Advanced Settings
  • uncheck Change frequency

Probably better to allow google to determine for itself how frequently to index in most cases. And if you need more control over crawling to try and control it using Webmaster Tools instead of the changefreq tag.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top