LaravelPackages.net
Acme Inc.
Toggle sidebar
lopatin96/laravel-sitemap

Laravel sitemap

7.640
0
1.0.8
About lopatin96/laravel-sitemap

lopatin96/laravel-sitemap is a Laravel package for laravel sitemap. It currently has 0 GitHub stars and 7.640 downloads on Packagist (latest version 1.0.8). Install it with composer require lopatin96/laravel-sitemap. Discover more Laravel packages by lopatin96 or browse all Laravel packages to compare alternatives.

Last updated

Install

Publish config

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

and specify your sitemap settings in config/sitemap.php

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,
            ]);
        });
    }
}
Comments