{
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)
'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),
];
<?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');