I’m using the laravel-seo-sitemap package to generate sitemap XML files in a Laravel 10 application.
I have a paginated blog route like this:
Route::prefix('/blog')->group(function () {
Route::get('/', [BlogController::class, 'index'])
->name('support.blog.index')
->priority('0.6')
->sitemap();
});
This correctly adds /blog to the sitemap, but I also want to include paginated versions like /blog?page=2
, /blog?page=3
, etc., since those contain unique and crawlable content (e.g. paginated archive listings).
How can I configure the package to generate sitemap entries for each page of the pagination?
Ideally, I’d like to specify:
- The total number of pages dynamically (from a model or query)
- The route pattern to apply pagination (/blog?page=2, /blog?page=3, …)
Is there a way to extend the sitemap generator with a custom SitemapItemTemplate or hook into the route’s sitemap registration?
Any example or guidance would be appreciated.
https://github.com/VeiligLanceren-nl/laravel-seo-sitemap
I already did try to use the template but it didn’t work out as wished.
I was expecting that this will solve the issue but it not worked out