sitemap icon indicating copy to clipboard operation
sitemap copied to clipboard

Sitemap Limits

Open graystevens opened this issue 10 years ago • 3 comments

Can this automatically identify indexes over the 50,000 limit and produce multiple indexes when this occurs?

graystevens avatar Sep 18 '14 12:09 graystevens

I suppose it could, the question would be how should it route to multiple sitemaps. If you have any good ideas on how to approach this let me know.

Here's how I went about implementing it in one of my controllers, using an optional integer page parameter in a route. I guess the package could somehow implement something similar internally?

public function posts($page = 0)
{
    $tagsPerSitemap = 1000;

    $posts = Post::skip($page * $tagsPerSitemap)
        ->take($tagsPerSitemap)
        ->get();

        foreach ($posts as $post)
        {
            Sitemap::addTag(route('posts.show', $post->id), $post->created_at, 'daily', '0.8');
        }

        return Sitemap::renderSitemap();
}

dwightwatson avatar Sep 18 '14 12:09 dwightwatson

I think you should also note that if your records have a lot of columns, to only select the ones you need to create the tag ... otherwise the process will quite without warning and you'll be presented with a blank screen.

dcolumbus avatar Jan 06 '15 21:01 dcolumbus

Cool, I've added some details to the docs about using select() and chunk() to reduce the memory being used for a sitemap request - that should alleviate most blank screen issues.

dwightwatson avatar Jan 07 '15 04:01 dwightwatson