1

I just created an XML sitemap in Drupal 7. As I click on the 'rebuilt links' button, all my content pages are assigned random frequencies and the module does not give me an option to edit content frequencies.

For eg: I have 15 content pages and all these pages share the same content type. I assigned priority of 0.9 to this content type. As I hit 'rebuilt links', few pages were randomly assigned daily frequency, where as rest of the pages were given monthly frequency.

Is there a way I can assign uniform frequency to all my content pages? or edit individual page frequencies? What exactly is making the XML site map module assign two different sets of frequencies to the same content type?

1

Is there a way I can assign uniform frequency to all my content pages? or edit individual page frequencies?

Not through the UI as far as I know, but it's possible in code using hook_xmlsitemap_link_alter():

function MYMODULE_xmlsitemap_link_alter(&$link) {
  if ($link['type'] == 'node' && $link['subtype'] == 'article') {
    $link['changefreq'] = 86400;
  }
}

$link also has a loc field which contains the router path for the node (e.g. "node/1"), although it's not ideal you can use that quite reliably to determine what specific node is being dealt with.

What exactly is making the XML site map module assign two different sets of frequencies to the same content type?

It's intentional - the change frequency for each link is calculated dynamically by the module. I assume the idea is that giving Google an accurate change frequency is better than setting something static and then ultimately struggling or failing to live up to it in the mighty engine's eyes. Doesn't always work like that in practice, of course.

  • I have it sorted now. Thanks for sharing the snippet :D – Flora Merryfellow Nov 30 '15 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.