#34: sitemap.xml generator now checks for albums and photos that are accessible to the current user (so anonymous albums aren't included in search engine listings.)

This commit is contained in:
Andy Heathershaw 2017-09-10 12:48:48 +01:00
parent 2caa1c8fbc
commit e1ad66c9ef

View File

@ -51,8 +51,11 @@ class DefaultController extends Controller
$lastModifiedPhoto = Photo::orderBy('updated_at', 'desc')->first();
$this->createSitemapNode($xml, $root, route('home'), (is_null($lastModifiedPhoto) ? '' : $lastModifiedPhoto->updated_at), '1.0');
// Albums the current user is allowed to access
$albumIDs = DbHelper::getAlbumIDsForCurrentUser();
// Add each album URL
$albums = Album::orderBy('name');
$albums = Album::whereIn('id', $albumIDs)->orderBy('name');
$albums->chunk(100, function($albumsChunk) use ($xml, $root)
{
/** @var Album $album */
@ -64,7 +67,7 @@ class DefaultController extends Controller
});
// Add each photo URL
$photos = Photo::orderBy('name');
$photos = Photo::whereIn('album_id', $albumIDs)->orderBy('name');
$photos->chunk(100, function($tempPhotos) use ($xml, $root)
{
/** @var Photo $photo */