PHPackages                             fuelviews/laravel-sitemap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fuelviews/laravel-sitemap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fuelviews/laravel-sitemap
=========================

Laravel sitemap package

v1.0.5(6mo ago)02.5k↑200%[8 PRs](https://github.com/fuelviews/laravel-sitemap/pulls)MITPHPPHP ^8.3CI passing

Since Mar 6Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/fuelviews/laravel-sitemap)[ Packagist](https://packagist.org/packages/fuelviews/laravel-sitemap)[ Docs](https://github.com/fuelviews/laravel-sitemap)[ RSS](/packages/fuelviews-laravel-sitemap/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (41)Used By (0)

Laravel Sitemap Package
=======================

[](#laravel-sitemap-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/67cf7dd0830ac93327645975b842e646e59d6d8132e17d26f094251794ab5d86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6675656c76696577732f6c61726176656c2d736974656d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuelviews/laravel-sitemap)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1329fc51cc339d0eb1e3323e179db5fb089b3f75e57aee87390b6a9366c55446/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675656c76696577732f6c61726176656c2d736974656d61702f72756e2d74657374732e796d6c3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fuelviews/laravel-sitemap/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/04fe32e3eb17ecc95218e3b0cacd05bd272c7ed67005235fe5a7daac4c00d88d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675656c76696577732f6c61726176656c2d736974656d61702f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/fuelviews/laravel-sitemap/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/e5f69e71590356d74c6994545ed2bf0d0dc38ed031f012fe7afe8a725cf0b55c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6675656c76696577732f6c61726176656c2d736974656d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuelviews/laravel-sitemap)[![PHP Version](https://camo.githubusercontent.com/33430a1c9affe51d23840404e5b74e01208118f8e2e48b63a9413b89296982c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/9a53bef6bfbb6cb990aa06777c8b0a19b5ef9f43dd3c3747bbe19bc39630167b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d2535453130253743253545313125374325354531322d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

Laravel Sitemap is a robust and intelligent solution for automatically generating XML sitemaps for your Laravel application. Built on top of Spatie's excellent sitemap package, it provides advanced crawling capabilities, model integration, and flexible configuration options.

Requirements
------------

[](#requirements)

- PHP ^8.3
- Laravel ^10.0 || ^11.0 || ^12.0
- Spatie Sitemap ^2.0
- Spatie Crawler ^7.0

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require fuelviews/laravel-sitemap
```

Publish the configuration file:

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

This will create a `config/fv-sitemap.php` file where you can customize your sitemap settings.

Basic Usage
-----------

[](#basic-usage)

### Generate Sitemap

[](#generate-sitemap)

Generate your sitemap using the Artisan command:

```
php artisan sitemap:generate
```

### Access Your Sitemap

[](#access-your-sitemap)

Once generated, your sitemap will be available at:

```
https://yoursite.com/sitemap.xml

```

### Using the Facade

[](#using-the-facade)

```
use Fuelviews\Sitemap\Facades\Sitemap;

// Get sitemap content (generates if not exists)
$content = Sitemap::getSitemapContents('sitemap.xml');
```

### In Blade Templates

[](#in-blade-templates)

Link to your sitemap in templates:

```

```

Configuration
-------------

[](#configuration)

### Basic Configuration

[](#basic-configuration)

The main configuration options in `config/fv-sitemap.php`:

```
return [
    // Storage disk for sitemap files
    'disk' => env('SITEMAP_DISK', 'public'),

    // Generate sitemap index for large sites
    'exclude_subcategory_sitemap_links' => env('SITEMAP_USE_INDEX', true),

    // Exclude redirect URLs
    'exclude_redirects' => env('SITEMAP_EXCLUDE_REDIRECTS', true),

    // Routes to exclude
    'exclude_route_names' => [
        // 'admin.*',
        // 'api.*',
    ],

    // Paths to exclude
    'exclude_paths' => [
        // '/admin',
        // '/dashboard',
    ],

    // Specific URLs to exclude
    'exclude_urls' => [
        '/sitemap.xml',
        '/pages_sitemap.xml',
        '/posts_sitemap.xml',
    ],

    // Models to include in posts sitemap
    'post_model' => [
        // App\Models\Post::class,
    ],
];
```

### Environment Variables

[](#environment-variables)

You can use environment variables for common settings:

```
# .env file
SITEMAP_DISK=public
SITEMAP_USE_INDEX=true
SITEMAP_EXCLUDE_REDIRECTS=true
```

Advanced Usage
--------------

[](#advanced-usage)

### Model Integration

[](#model-integration)

To include your Eloquent models in the sitemap, implement the `Sitemapable` interface:

```
