Its not possible to set this on webspace but you can create your custom EventSubscriber to set this value on persist, an example subscriber could look like the following:
namespace App\Subscriber\Document;
use Sulu\Component\DocumentManager\Event\PersistEvent;
use Sulu\Component\DocumentManager\Events;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Sulu\Bundle\PageBundle\Document\PageDocument;
class NoIndexSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
Events::PERSIST => 'handlePersist',
];
}
public function handlePersist(PersistEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof PageDocument) {
return;
}
$extensionData = $document->getExtensionsData()->toArray();
if (array_key_exists('noIndex', $extensionData['seo'])) {
// do nothing when extension data was set manually
return;
}
$extensionData['seo']['noIndex'] = true;
}
}
Its important that the service is tagged with sulu_document_manager.event_subscriber
you can do this in the config/services.yaml
the following way:
App\Subscriber\Document\:
resource: '../src/Subscriber/Document'
tags: ['sulu_document_manager.event_subscriber'}]
Make sure it is listed here:
bin/console sulu:document:subscriber:debug persist