#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:
parent
1f2552c743
commit
693f0c6760
@ -51,8 +51,11 @@ class DefaultController extends Controller
|
|||||||
$lastModifiedPhoto = Photo::orderBy('updated_at', 'desc')->first();
|
$lastModifiedPhoto = Photo::orderBy('updated_at', 'desc')->first();
|
||||||
$this->createSitemapNode($xml, $root, route('home'), (is_null($lastModifiedPhoto) ? '' : $lastModifiedPhoto->updated_at), '1.0');
|
$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
|
// Add each album URL
|
||||||
$albums = Album::orderBy('name');
|
$albums = Album::whereIn('id', $albumIDs)->orderBy('name');
|
||||||
$albums->chunk(100, function($albumsChunk) use ($xml, $root)
|
$albums->chunk(100, function($albumsChunk) use ($xml, $root)
|
||||||
{
|
{
|
||||||
/** @var Album $album */
|
/** @var Album $album */
|
||||||
@ -64,7 +67,7 @@ class DefaultController extends Controller
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add each photo URL
|
// Add each photo URL
|
||||||
$photos = Photo::orderBy('name');
|
$photos = Photo::whereIn('album_id', $albumIDs)->orderBy('name');
|
||||||
$photos->chunk(100, function($tempPhotos) use ($xml, $root)
|
$photos->chunk(100, function($tempPhotos) use ($xml, $root)
|
||||||
{
|
{
|
||||||
/** @var Photo $photo */
|
/** @var Photo $photo */
|
||||||
|
Loading…
Reference in New Issue
Block a user