Skip to content

Commit

Permalink
sitemap enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
eng-gabrielscardoso committed Jul 7, 2024
1 parent e5312de commit 331e2d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Services/SitemapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Services;

use Carbon\Carbon;
use Illuminate\Support\Facades\Route;
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\Tags\Url;
Expand All @@ -17,7 +18,11 @@ public function generate()
foreach ($routes as $route) {
if (in_array('GET', $route->methods()) && $this->routeInWebFile($route)) {
$uri = $route->uri();
$sitemap->add(Url::create($uri));
$sitemap->add(Url::create($uri)
->setLastModificationDate(Carbon::now())
->setChangeFrequency(Url::CHANGE_FREQUENCY_WEEKLY)
->setPriority(0.1)
);
}
}

Expand Down

0 comments on commit 331e2d5

Please sign in to comment.