-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathroutes.php
26 lines (21 loc) · 850 Bytes
/
routes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
use Cms\Classes\Theme;
use Cms\Classes\Controller;
use Winter\Sitemap\Models\Definition;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFound;
Route::get('sitemap.xml', function ()
{
$themeActive = Theme::getActiveTheme()->getDirName();
try {
$definition = Definition::where('theme', $themeActive)->firstOrFail();
} catch (ModelNotFound $e) {
Log::info(trans('winter.sitemap::lang.definition.not_found'));
return App::make(Controller::class)->setStatusCode(404)->run('/404');
}
return Response::make($definition->generateSitemap())
->header('Content-Type', 'application/xml');
});
Route::get('sitemap.xsl', function () {
return Response::make(file_get_contents(plugins_path('winter/sitemap/assets/sitemap.xsl')))
->header('Content-Type', 'text/xsl');
});