Merge pull request #170 from xini/fix-priority-calculations

fix hierarchy based priority calculations
This commit is contained in:
Will Rossiter 2020-11-19 11:34:29 +13:00 committed by GitHub
commit b5f322646f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,7 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
if (!$priority) { if (!$priority) {
$parentStack = $this->owner->getAncestors(); $parentStack = $this->owner->getAncestors();
$numParents = is_array($parentStack) ? count($parentStack) - 1 : 0; $numParents = $parentStack->count();
$num = max(0.1, 1.0 - ($numParents / 10)); $num = max(0.1, 1.0 - ($numParents / 10));
$result = str_replace(",", ".", $num); $result = str_replace(",", ".", $num);