Skip to content

Commit

Permalink
Disable 4programmers.dev from search engine
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Jan 24, 2024
1 parent 522962b commit 710174d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Providers/SeoServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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';
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/Seo/Meta/MetaRobotsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@ public function category()
{
$this->assertIndexable('/Forum');
}

/**
* @test
*/
public function developerEnvironment()
{
$this->assertNoIndexable('http://4programmers.dev/');
}
}

0 comments on commit 710174d

Please sign in to comment.