lucacri/laravelsimplesitemap

A Laravel package to create simple sitemaps

3.0.0 2024-04-24 18:08 UTC

This package is auto-updated.

Last update: 2024-04-24 18:10:17 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A very simple package to create sitemaps from specific URLs

Installation

You can install the package via composer:

composer require lucacri/laravelsimplesitemap

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravelsimplesitemap-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravelsimplesitemap-config"

This is the contents of the published config file:

return [
    /*
     * Storage disk and path where to save the sitemap
     *
     */
    'save' => [
        'disk' => 'public',
        'path' => 'sitemap.xml'
    ],
    /*
     * The URL where your sitemap will be accessible.
     * This value will be used to inform Google of the changed sitemap
     *
     */
    'sitemap_url' => 'http://example.com/sitemap.xml',

    /*
    * An array of URLs to include in the sitemap
    * Example:
    *  [
            'loc'        => 'https://example.com',
            'changefreq' => 'weekly',
            'priority'   => 0.9
        ]
    */
    'urls' => [

        // example

        [
            'loc'        => 'https://example.com',
            'changefreq' => 'weekly',
            'priority'   => 0.9
        ]

    ]
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="laravelsimplesitemap-views"

Usage

php artisan simplesitemap:create --ping-google

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

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