function xmlsitemap_recalculate_changefreq in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap.module \xmlsitemap_recalculate_changefreq()
- 7.2 xmlsitemap.module \xmlsitemap_recalculate_changefreq()
- 2.x xmlsitemap.module \xmlsitemap_recalculate_changefreq()
Recalculate the changefreq of a sitemap link.
Parameters
array $link: A sitemap link array.
1 call to xmlsitemap_recalculate_changefreq()
- XmlSitemapUnitTest::testRecalculateChangefreq in tests/
src/ Functional/ XmlSitemapUnitTest.php - Test for xmlsitemap_recalculate_changefreq().
File
- ./
xmlsitemap.module, line 1122 - xmlsitemap XML sitemap
Code
function xmlsitemap_recalculate_changefreq(array &$link) {
$time = \Drupal::time()
->getRequestTime();
$link['changefreq'] = round(($link['changefreq'] * $link['changecount'] + ($time - $link['lastmod'])) / ($link['changecount'] + 1));
$link['changecount']++;
$link['lastmod'] = $time;
}