mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-30 04:15:58 +08:00
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:
@ -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');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user