mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
Make sure SiteTree sitemap index uses correct last edited value.
This commit is contained in:
parent
a2297c43ef
commit
937d820d95
@ -271,10 +271,16 @@ class GoogleSitemap {
|
||||
|
||||
for($i = 1; $i <= $neededForPage; $i++) {
|
||||
$sliced = $instances
|
||||
->limit($countPerFile, ($i - 1) * $countPerFile)
|
||||
->last();
|
||||
->limit($countPerFile, ($i - 1) * $countPerFile);
|
||||
$lastEdited = null;
|
||||
|
||||
$lastModified = ($sliced) ? $sliced->dbObject('LastEdited')->Format('Y-m-d') : date('Y-m-d');
|
||||
foreach ($sliced as $page) {
|
||||
if ($page->dbObject('LastEdited') > $lastEdited) {
|
||||
$lastEdited = $page->dbObject('LastEdited');
|
||||
}
|
||||
}
|
||||
|
||||
$lastModified = ($lastEdited) ? $lastEdited->Format('Y-m-d') : date('Y-m-d');
|
||||
|
||||
$sitemaps->push(new ArrayData(array(
|
||||
'ClassName' => 'SiteTree',
|
||||
@ -440,4 +446,4 @@ class GoogleSitemap {
|
||||
Config::inst()->remove('GoogleSitemap', 'enabled');
|
||||
Config::inst()->update('GoogleSitemap', 'enabled', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user