- 🇩🇰Denmark ressa Copenhagen
It is odd that there is a "Default change frequency" option under a content type, yet it doesn't do anything. Setting it to "Daily" ought to do that ...
In my opinion this should be raised to "Major", since having a wrong "Yearly" value may cause those pages to get ignore, and not get crawled.
And in essence, that is the whole point of this module -- getting pages crawled.
> Q: But I note that it also seems to be related to the 'last updated' date for the entity in question.
> [...]
> A: Right now, the entity changefreq values are always automatically calculated based on the time between revisions, there is no ability to set a specific changefreq for these items.This won't work, if data displayed on the node page is pulled in via a view -- the content is actually changing on a regular basis, but to Drupal, it just looks like a stale node.
- 🇫🇷France raphaelbertrand Lauris
i am not sure it is a bug as it seem to be wanted in code:
xmlsitemap.module/** * Determine the frequency of updates to a link. * * @param int $interval * An interval value in seconds. * * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup * A string representing the update frequency according to the sitemaps.org * protocol. */ function xmlsitemap_get_changefreq($interval, bool $translated = FALSE) { if ($interval <= 0 || !is_numeric($interval)) { return FALSE; } foreach (xmlsitemap_get_changefreq_options() as $value => $frequency) { if ($interval <= $value) { return $translated ? $frequency : $frequency->getUntranslatedString(); } } return $translated ? t('never', [], ['context' => 'At no time']) : 'never'; }
src/XmlSitemapGenerator.php
if ($link['lastmod']) { $element['lastmod'] = gmdate($lastmod_format, $link['lastmod']); // If the link has a lastmod value, update the changefreq so that links // with a short changefreq but updated two years ago show decay. // We use abs() here just incase items were created on this same cron // run because lastmod would be greater than the request time. $link['changefreq'] = (abs($this->time->getRequestTime() - $link['lastmod']) + $link['changefreq']) / 2; } if ($link['changefreq']) { $element['changefreq'] = xmlsitemap_get_changefreq($link['changefreq']); }
but i agree that the setting is confusing and for my usage i change the $link['lastmod'] as a workaround in a custom function
xmlsitemap_link_alter(&$link) for view pages or other pages with computed fields too get the good changefreq. - 🇩🇰Denmark ressa Copenhagen
You're right. Technically, it works as designed, but the way it works is not ideal.
Let's change the Status to be more precise.
- First commit to issue fork.
- Merge request !53Draft: Issue #2903144: Changing frequency to daily doesn't change the sitemap view to daily → (Open) created by malcomio
- First commit to issue fork.