diff --git a/app/Providers/SeoServiceProvider.php b/app/Providers/SeoServiceProvider.php index a2110f467e..d003203862 100644 --- a/app/Providers/SeoServiceProvider.php +++ b/app/Providers/SeoServiceProvider.php @@ -4,6 +4,7 @@ use Coyote\Domain\Seo\Schema; use Coyote\View\Twig\TwigLiteral; use Illuminate\Contracts\View\View; +use Illuminate\Http\Request; use Illuminate\Support\ServiceProvider; use Illuminate\View\Factory; @@ -23,7 +24,12 @@ public function boot(): void private function metaRobots(): string { - if ($this->app['request']->getRequestUri() === '/Forum/Interesting') { + /** @var Request $request */ + $request = $this->app['request']; + if ($request->getHost() === '4programmers.dev') { + return 'noindex,nofollow'; + } + if ($request->getRequestUri() === '/Forum/Interesting') { return 'noindex,nofollow'; } return 'index,follow'; diff --git a/tests/Unit/Seo/Meta/MetaRobotsTest.php b/tests/Unit/Seo/Meta/MetaRobotsTest.php index 7bb13ded99..bffc892e0a 100644 --- a/tests/Unit/Seo/Meta/MetaRobotsTest.php +++ b/tests/Unit/Seo/Meta/MetaRobotsTest.php @@ -32,4 +32,12 @@ public function category() { $this->assertIndexable('/Forum'); } + + /** + * @test + */ + public function developerEnvironment() + { + $this->assertNoIndexable('http://4programmers.dev/'); + } }