Added configurable robots.txt file.

Deleted old static file.
Default output depends on app-public setting.
Otherwise can be overidden in `.env` file via `ALLOW_ROBOTS`
Otherwise view file can be customized.

Fixes #779
This commit is contained in:
Dan Brown
2018-03-31 12:41:40 +01:00
parent 7f437c2e3c
commit 1a72208d27
6 changed files with 70 additions and 2 deletions

View File

@ -118,4 +118,20 @@ class HomeController extends Controller
{
return view('partials/custom-head-content');
}
/**
* Show the view for /robots.txt
* @return $this
*/
public function getRobots()
{
$sitePublic = setting('app-public', false);
$allowRobots = config('app.allow_robots');
if ($allowRobots === null) {
$allowRobots = $sitePublic;
}
return response()
->view('robots', ['allowRobots' => $allowRobots])
->header('Content-Type', 'text/plain');
}
}