This package can generate a sitemap with images according to Google Specifications.
It's basically built on top of Spatie's laravel-sitemap. The reason why I create it, it's because Spatie doesn't plan to add this functionality to his own package (see here for more info).
Hey folks,
Do you like this package? Do you find it useful and it fits well in your project?
I am glad to help you, and I would be so grateful if you considered supporting my work.
You can even choose 😃:
- You can sponsor me 😎 with a monthly subscription.
- You can buy me a coffee ☕ or a pizza 🍕 just for this package.
- You can plant trees 🌴. By using this link we will both receive 30 trees for free and the planet (and me) will thank you.
- You can "Star ⭐" this repository (it's free 😉).
You can install the package via composer:
composer require lemaur/laravel-image-sitemap
You can publish the config file with:
php artisan vendor:publish --provider="Lemaur\Sitemap\SitemapServiceProvider" --tag="laravel_image_sitemap-config"
You can refer directly to Spatie's laravel-sitemap documentation to which I've added the possibility to include images. See the example below.
use Carbon\Carbon;
use Lemaur\Sitemap\Sitemap;
use Lemaur\Sitemap\Tags\Image;
use Lemaur\Sitemap\Tags\Url;
Sitemap::create()
->add(Url::create('/home')
->setLastModificationDate(Carbon::yesterday())
->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY)
->setPriority(0.1)
->addImage('/url/to/images.jpg')
->addImage(
Image::create('/url/to/another-image.jpg')
->setTitle('Image Title')
->setCaption('Image Alt Text')
->setGeoLocation('Image Geo Location')
->setLicense('https://url/to/the/license')
))
->add(...)
->writeToFile($path);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.