91395db9c4
Automatically generates the content, including the correct link to the sitemap.
26 lines
675 B
PHP
26 lines
675 B
PHP
<?php
|
|
|
|
use AntCMS\AntPlugin;
|
|
use AntCMS\AntConfig;
|
|
use AntCMS\AntTools;
|
|
|
|
class RobotstxtPlugin extends AntPlugin
|
|
{
|
|
public function handlePluginRoute(array $route)
|
|
{
|
|
$protocol = AntConfig::currentConfig('forceHTTPS') ? 'https' : 'http';
|
|
$baseURL = AntConfig::currentConfig('baseURL');
|
|
|
|
$robotstxt = 'User-agent: *' . "\n";
|
|
$robotstxt.= 'Disallow: /plugin/' . "\n";
|
|
$robotstxt.= 'Sitemap: ' . $protocol . '://' . AntTools::repairURL($baseURL . '/sitemap.xml' . "\n");
|
|
header("Content-Type: text/plain");
|
|
echo $robotstxt;
|
|
exit;
|
|
}
|
|
public function getName()
|
|
{
|
|
return 'Robotstxt';
|
|
}
|
|
}
|