-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfea875
commit a718b85
Showing
3 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Created by Nivanka Fonseka (nivanka@silverstripers.com). | ||
* User: nivankafonseka | ||
* Date: 5/23/19 | ||
* Time: 7:28 PM | ||
* To change this template use File | Settings | File Templates. | ||
*/ | ||
|
||
namespace SilverStripers\seo\Control; | ||
|
||
|
||
use SilverStripe\Control\Controller; | ||
use SilverStripe\SiteConfig\SiteConfig; | ||
|
||
class RobotsTXTController extends Controller | ||
{ | ||
|
||
public function index() | ||
{ | ||
$this->getResponse()->addHeader('Content-Type', 'text/plain'); | ||
$siteConfig = SiteConfig::current_site_config(); | ||
if($siteConfig->RobotsTXT) { | ||
return $siteConfig->RobotsTXT; | ||
} | ||
return <<<ROBOTS | ||
User-agent: * | ||
Allow: / | ||
ROBOTS; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters