curlychoi/laravel-sitemap

Sitemap management package using laravel facede

Downloads

4

Stars

0

Version

v1.0.0

Laravel Sitemap

This package helps you create a sitemap in your project. The Laravel facade allows you to add or remove urls from your sitemap at the location of your choice.

Installation

First, install the package via composer:

composer require curlychoi/laravel-sitemap

The package will automatically register a service provider and alias.

And to create a database to store sitemap urls, publish the migration files and run the migrate.

php artisan vendor:publish --provider="Curlychoi\LaravelSitemap\Providers\SitemapServiceProvider" --tag=migrations
php artisan migrate

Usage

Creating a sitemap url

$url = request()->getSchemeAndHttpHost() . '/posts/1';
Sitemap::put($url);

Removing a sitemap url

$url = request()->getSchemeAndHttpHost() . '/posts/1';
Sitemap::forget($url);

Sitemap url to provide in search engine webmaster tools

https://your-domain.com/sitemap.xml

This sitemap.xml is compliant with the sitemaps protocol.

Testing

With the server running you can execute the tests:

$ composer test

License

The MIT License (MIT). Please see License File for more information.

curlychoi

Author

curlychoi