]> _ Git - cubist_cms-back.git/commitdiff
wip #2950 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Aug 2019 14:45:52 +0000 (16:45 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Aug 2019 14:45:52 +0000 (16:45 +0200)
src/app/Http/Controllers/CubistSEOController.php
src/resources/config/cubist.php
src/routes/cubist/backpack/seo.php

index a3adce37d87b913d71de53a953dc68cbf6ea1eeb..7319d563e71e59e29bee58f9ba829be1924d8787 100644 (file)
@@ -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)
index 7ed9d1b23cf0dca88e1bb9093a0f2ed3a6475a90..086bef8d17b4bd15dbc7c1111e16653c013bcd0c 100644 (file)
@@ -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),
 ];
index ecb1467cb4ee3d5b84ce99918fb46bc7eba6652d..4b0c59a7020f510d14accb20d681bdc5d9342d60 100644 (file)
@@ -1,3 +1,3 @@
 <?php
-Route::get('/robots.txt', 'CubistSEOController@robots');
-Route::get('/sitemap.xml', 'CubistSEOController@sitemap');
+Route::get('/robots.txt', '\Cubist\Backpack\app\Http\Controllers\CubistSEOController@robots');
+Route::get('/sitemap.xml', '\Cubist\Backpack\app\Http\Controllers\CubistSEOController@sitemap');