lopatin96/laravel-sitemap

Laravel sitemap

Installs: 7 640

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/lopatin96/laravel-sitemap

1.0.8 2025-03-02 12:28 UTC

This package is auto-updated.

Last update: 2025-09-30 13:45:35 UTC


README

Publish config

php artisan vendor:publish --tag="laravel-sitemap-config"

and specify your sitemap settings in config/sitemap.php

Link to sitemap

Your sitemap.xml file is under http:://127.0.0.1/sitemap.xml`

Publishing

Config

php artisan vendor:publish --tag="laravel-sitemap-config"

Custom pages

Set custom_pages to true in config/sitemap.php and add a class to your project:

namespace App\Services\SitemapCustomPages;

use App\Models\Item;

class SitemapCustomPages extends \Atin\LaravelSitemap\Services\SitemapCustomPages
{
    public function addPages(): void
    {
        Item::get()->each(function ($item) {
            $this->pages->push([
                'url' => url("/offers/$item->slug"),
                'last_modified' => $item->updated_at,
            ]);
        });
    }
}