Skip to content

Commit

Permalink
Support for Statamic 4
Browse files Browse the repository at this point in the history
  • Loading branch information
martyf committed Mar 29, 2023
1 parent 9a6b838 commit e1238b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"require": {
"php": "^8.1",
"statamic/cms": "^3.3"
"statamic/cms": "^3.3|^4.0"
},
"extra": {
"statamic": {
Expand Down
6 changes: 4 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use MityDigital\Sitemapamic\Http\Controllers\SitemapamicController;

\Statamic\Facades\Site::all()
->pluck('url')
->map(fn($url) => \Statamic\Facades\URL::makeRelative($url))
->unique()
->each(fn($site) => Route::prefix($site)->group(function () {
// add the standard sitemap.xml
Route::get('sitemap.xml', 'SitemapamicController@show');
Route::get('sitemap.xml', [SitemapamicController::class, 'show']);

// add the submap xml
Route::get('sitemap_{submap}.xml', 'SitemapamicController@show');
Route::get('sitemap_{submap}.xml', [SitemapamicController::class, 'show']);
}));

0 comments on commit e1238b7

Please sign in to comment.