feat(seo): add SEO controller for robots.txt and sitemap.xml
- Implemented SeoController with methods for serving robots.txt and sitemap.xml. - Updated robots.txt logic to disallow access to /admin and /api paths. - Enhanced meta tags and Open Graph data in home.html.twig for better SEO. - Added X-Robots-Tag header in SecurityHeadersSubscriber for /admin and /api routes.
This commit is contained in:
@@ -29,6 +29,10 @@ class SecurityHeadersSubscriber implements EventSubscriberInterface
|
||||
if (str_starts_with($path, '/api') && !str_starts_with($path, '/api/doc')) {
|
||||
$response->headers->set('Content-Security-Policy', "default-src 'none'");
|
||||
}
|
||||
|
||||
if (str_starts_with($path, '/admin') || str_starts_with($path, '/api')) {
|
||||
$response->headers->set('X-Robots-Tag', 'noindex, nofollow');
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
|
||||
Reference in New Issue
Block a user