Skip to content

Commit f378269

Browse files
committed
Refactor sitemap configuration to allow customization of the source of content and to include only visible posts.
1 parent 5e93e83 commit f378269

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ php artisan vendor:publish --provider="Fuelviews\Sitemap\SitemapServiceProvider"
3030
This is the contents of the published config file:
3131

3232
```php
33+
<?php
34+
3335
return [
3436
/**
3537
* Specifies the default filesystem disk that should be used.
@@ -73,10 +75,19 @@ return [
7375
'/pages_sitemap.xml',
7476
'/posts_sitemap.xml',
7577
],
78+
79+
/**
80+
* Specifies the model class to be used for fetching posts to be included in the sitemap.
81+
* This setting allows for customization of the source of content, enabling the sitemap to reflect the structure and content of your website accurately.
82+
* The specified model should implement any necessary logic to retrieve only the posts that should be visible to search engines.
83+
*/
84+
'post_model' => [
85+
//App\Models\Post::class,
86+
],
7687
];
7788
```
7889

79-
You can also add your models directly by implementing the \Spatie\Sitemap\Contracts\Sitemapable interface.
90+
You can also add your models directly by implementing the \Spatie\Sitemap\Contracts\Sitemapable interface. You also need to define your post_model in the fv-sitemap.php config file.
8091
```php
8192
namespace App\Models;
8293

config/fv-sitemap.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
* The specified model should implement any necessary logic to retrieve only the posts that should be visible to search engines.
5151
*/
5252
'post_model' => [
53-
App\Models\Post::class,
53+
//App\Models\Post::class,
5454
],
55-
5655
];

0 commit comments

Comments
 (0)