title: How do you add a view to the sitemap generated by the XML Sitemap module in Drupal?
body: <p>I have a Drupal 6 view that has several arguments. I want to add each unique set of arguments / page to the sitemap created by the XML Sitemap module in Drupal. I have a custom module that creates a menu item for each possible argument combination that is passed into the view, as there are a finite number of them.</p>
  
  <p>I tried following these directions:
  <a href="http://drupal.org/node/507674" rel="nofollow">http://drupal.org/node/507674</a>
  but that didn't work.</p>
  
  <p>I then tried to add these links programmatically using this excellent comment:
  <a href="http://drupal.org/node/711100#comment-3150592" rel="nofollow">http://drupal.org/node/711100#comment-3150592</a></p>
  
  <p>However, of the 150+ links I create in a loop of calls to xmlsitemap_link_save(), only 1 was ever saved. The link entry did not possesses any unique characteristics I could detect when compared to other entries that did not get added to the site map.</p>
  
  <p>I build all the links in an array $links. Here is a typical array entry:</p>
  
  <pre><code>$links[] = array(
      'type' =&gt; 'mymodulename',
      'id' =&gt; '3000-10000',
      'loc' =&gt; 'washington-dc',
      'lastmod' =&gt; time(),
      'changefreq' =&gt; 4600,
      'priority' =&gt; 0.5,
  );
  </code></pre>
  
  <p>I am trying to describe the URL:</p>
  
  <blockquote>
    <p>example.com/washington-dc/3000-1000</p>
  </blockquote>
  
  <p>I then loop the entire $links array to save each link:</p>
  
  <pre><code>foreach($links as $link) {
      xmlsitemap_link_save($link);
  }
  </code></pre>
  
  <p>Finally, all of this code is in the function:</p>
  
  <pre><code>mymodule_xmlsitemap_links()
  </code></pre>
  
  <p>which I call from hook_cron:</p>
  
  <pre><code>function mymodule_cron() {
      mymodule_xmlsitemap_links();
      return true;
  }
  </code></pre>
  
  <p>I have confirmed that:</p>
  
  <ul>
  <li>My hook_cron() is called during cron</li>
  <li>Only one link from $links is saved</li>
  <li>The setting for total number of links to process in the sitepmap module settings is 250, more than enough for my $links array (~150) and the existing site map (47 links)</li>
  <li>The log shows the XML sitemap generation running and no errors are reported</li>
  </ul>
  
  <p>Any idea what I'm doing wrong?</p>