I have a drupal 7.52 website, I noticed that the number of entries in the sitemap.xml file constantly reduces with time even if the number of nodes on the websites is the same or increases. It seems that while nodes being deleted are correctly removed from sitemap new nodes are added to the 'xmlsitemap' table but all with access =0. Even if new nodes are accessible to anonymous user (node_access table gid=0 grant_view=1) function xmlsitemap_node_view_access returns false, function exits at line 321 and the result of the query seems to be empty.
Any help appreciated. Thanks.

Comments

oppure created an issue. See original summary.

oppure’s picture

Issue summary: View changes
oppure’s picture

Issue summary: View changes
oppure’s picture

Title: Nodes wrongly marked as not accessible by anonymous user in wmlsitemap table and not included in sitemap.xml » Nodes wrongly marked as not accessible by anonymous user in xmlsitemap table and not included in sitemap.xml
oppure’s picture

Title: Nodes wrongly marked as not accessible by anonymous user in xmlsitemap table and not included in sitemap.xml » New nodes wrongly marked as not accessible by anonymous user in xmlsitemap table and not included in sitemap.xml
Category: Bug report » Support request
Issue summary: View changes
oppure’s picture

Noone able/interested in reproducing/investigating this issue?

oppure’s picture

Category: Support request » Bug report
bwaindwain’s picture

See https://www.drupal.org/project/xmlsitemap/issues/690120 for a similar issue and possible workaround.

See longstanding issue in core https://www.drupal.org/project/drupal/issues/690520

rahim123’s picture

I'm not sure of the cause, but I'm experiencing the same issue. Every time I regenerate the sitemap there are *less* links. Only rebuilding it completely makes new nodes appear. I tried clearing the caches and made sure that there is no "Minimum sitemap lifetime" while testing. I also tested the most current 2.x-dev version, but it behaves the same. I also tried adding the recommended workaround to xmlsitemap_node.module:

  // Always recalculate changefreq and changecount.
  $timestamps = xmlsitemap_node_get_timestamps($node);
  $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0;
  $node->xmlsitemap['changecount'] = $node->nid ? count($timestamps) - 1 : 0;


  // Temporary fix per https://www.drupal.org/node/690120#comment-2502430
  // in order to get around a core bug.
  node_access_acquire_grants($node);


  // The following values must always be checked because they are volatile.
  $node->xmlsitemap['loc'] = $uri['path'];

(The patches no longer apply, but I manually added the relevant lines in the context shown above)
Unfortunately, that also doesn't fix anything.

Any other suggestions?