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++) {
|
for($i = 1; $i <= $neededForPage; $i++) {
|
||||||
$sliced = $instances
|
$sliced = $instances
|
||||||
->limit($countPerFile, ($i - 1) * $countPerFile)
|
->limit($countPerFile, ($i - 1) * $countPerFile);
|
||||||
->last();
|
$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(
|
$sitemaps->push(new ArrayData(array(
|
||||||
'ClassName' => 'SiteTree',
|
'ClassName' => 'SiteTree',
|
||||||
|
Loading…
Reference in New Issue
Block a user