Create and generate sitemaps with ease
49
0
1
Package Data
Maintainer Username: carhelper
Maintainer Contact: freek@spatie.be (Freek Van der Herten)
Package Create Date: 2017-08-02
Package Last Update: 2017-08-02
Home Page: https://murze.be/2016/08/automatically-generate-a-sitemap-in-laravel/
Language: PHP
License: MIT
Last Refreshed: 2024-04-18 15:08:56
Package Statistics
Total Downloads: 49
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Generate sitemaps with ease (spatie/laravel-sitemap FORK)

Installation

First, install the package via composer:

composer require develop-carhelper/laravel-sitemap

Next up: installing the service provider

// config/app.php
'providers' => [
    ...
    Carhelper\Sitemap\SitemapServiceProvider::class,
];

Manually creating a sitemap

You can also create a sitemap fully manual:

use Carbon\Carbon;

Sitemap::create()
   ->add('/page1')
   ->add('/page2')
   ->add(Url::create('/page3')->setLastModificationDate(Carbon::create('2016', '1', '1')))
   ->add(Url::create('/page4')->addXhtmlLink([
       'hreflang' => 'de',
       'rel'      => 'alternate'
       'href'     => 'http://www.example.com/deutsch/'
   ]))
   ->writeToFile($sitemapPath);

Credits

License

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