From: Vincent Vanwaelscappel Date: Wed, 28 Aug 2019 14:45:52 +0000 (+0200) Subject: wip #2950 @0:10 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a626e6e943130ed492fcff8f9e7a25d3de031f44;p=cubist_cms-back.git wip #2950 @0:10 --- diff --git a/src/app/Http/Controllers/CubistSEOController.php b/src/app/Http/Controllers/CubistSEOController.php index a3adce3..7319d56 100644 --- a/src/app/Http/Controllers/CubistSEOController.php +++ b/src/app/Http/Controllers/CubistSEOController.php @@ -10,7 +10,15 @@ class CubistSEOController { public function robots(Request $request) { - + $response = ['User-agent: *']; + if (config('cubist.seo_robots', true)) { + $response[] = 'Disallow: /admin/'; + $response[] = 'Sitemap: ' . url('/sitemap.xml'); + } else { + $response[] = 'Disallow: /'; + } + + return response(implode("\n", $response))->header('Content-type', 'text/plain'); } public function sitemap(Request $request) diff --git a/src/resources/config/cubist.php b/src/resources/config/cubist.php index 7ed9d1b..086bef8 100644 --- a/src/resources/config/cubist.php +++ b/src/resources/config/cubist.php @@ -4,4 +4,5 @@ return [ 'internal_search_index' => env('CUBIST_INTERNAL_SEARCH_INDEX', strtolower(env('APP_NAME', 'App_name') . '_' . env('APP_ENV', 'dev'))), 'page_model' => '\App\Models\Page', 'settings_model' => '\App\Models\Settings', + 'seo_robots' => env('SEO_ROBOTS', true), ]; diff --git a/src/routes/cubist/backpack/seo.php b/src/routes/cubist/backpack/seo.php index ecb1467..4b0c59a 100644 --- a/src/routes/cubist/backpack/seo.php +++ b/src/routes/cubist/backpack/seo.php @@ -1,3 +1,3 @@