<?php declare(strict_types=1);
namespace App\Seo\Controller;
use App\Base\Controller\BaseController;
use App\Seo\Repository\SeoSettingsRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class SeoControllerController extends BaseController
{
#[Route(path: '/robots.txt', name: 'seo:robots')]
public function index(
Request $request,
SeoSettingsRepository $repository
): Response {
$settings = $repository->getOrCreate();
$response = new Response();
$response->setContent($settings->getRobots());
$response->headers->add(['Content-Type' => 'text/plain']);
return $response;
}
}