<?php declare(strict_types=1);
namespace EconsorDev\Subscriber;
use Shopware\Storefront\Page\GenericPageLoadedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class EconsorDevSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
GenericPageLoadedEvent::class => 'onPageLoaded',
];
}
public function onPageLoaded(GenericPageLoadedEvent $event)
{
if (!$event->getRequest()->isXmlHttpRequest()) {
$event->getPage()->getMetaInformation()->setRobots('noindex,nofollow');
}
}
}