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

@ -90,4 +90,35 @@ class PublicActionTest extends BrowserKitTest
$this->dontSee($page->name);
}
public function test_robots_effected_by_public_status()
{
$this->visit('/robots.txt');
$this->seeText("User-agent: *\nDisallow: /");
$this->setSettings(['app-public' => 'true']);
$this->visit('/robots.txt');
$this->seeText("User-agent: *\nDisallow:");
$this->dontSeeText("Disallow: /");
}
public function test_robots_effected_by_setting()
{
$this->visit('/robots.txt');
$this->seeText("User-agent: *\nDisallow: /");
config()->set('app.allow_robots', true);
$this->visit('/robots.txt');
$this->seeText("User-agent: *\nDisallow:");
$this->dontSeeText("Disallow: /");
// Check config overrides app-public setting
config()->set('app.allow_robots', false);
$this->setSettings(['app-public' => 'true']);
$this->visit('/robots.txt');
$this->seeText("User-agent: *\nDisallow: /");
}
}