---
title: Excluding CMS Pages
slug: klevu-magento-v4/excluding-cms-pages
docTags: 
createdAt: 2024-10-04T14:59:43.031Z
---

You may wish to exclude certain CMS pages from the sync.&#x20;

To do this we inject an `isIndexableCondition` into the `isIndexableConditions` array for the virtual type `Klevu\IndexingCms\Service\Determiner\IsIndexableDeterminer`

:::CodeblockTabs
XML

```xml
<virtualType name="Klevu\IndexingCms\Service\Determiner\IsIndexableDeterminer">
    <arguments>
        <argument name="isIndexableConditions" xsi:type="array">
            <item name="pageIsIndexableCondition"
                  xsi:type="object">Vendor\Module\Service\Determiner\ExcludedPagesIsIndexableCondition</item>
        </argument>
    </arguments>
</virtualType>
```
:::

Create that class, which must implement the `IsIndexableConditionInterface`&#x20;

:::CodeblockTabs
Vendor\Module\Service\Determiner\ExcludedPagesIsIndexableCondition.php

```php
<?php

namespace Vendor\Module\Service\Determiner;

use Klevu\IndexingApi\Service\Determiner\IsIndexableConditionInterface;
use Magento\Cms\Api\Data\PageInterface;

class ExcludedPagesIsIndexableConditionr implements IsIndexableConditionInterface
{
    /**
     * Edit routes as required
     * Alternatively inject these via di.xml
     *
     * @param string[]
     */
    private array $excludedPages = [
        'no-route',
        'service-unavailable',
    ];
    
    public function execute(
        ExtensibleDataInterface|PageInterface $entity,
        StoreInterface $store,
    ): bool {
        if (!($entity instanceof PageInterface)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Invalid argument provided for "$entity". Expected %s, received %s.',
                    PageInterface::class,
                    get_debug_type($entity),
                ),
            );
        }
        
        return !in_array(
            needle: $page->getIdentifier(), 
            haystack: $this->excludedPages, 
            strict: true,
        );
    }
}

```
:::

See [Entities Is Indexable Determiner](https://docs.klevu.com/klevu-magento-v4/entities-is-indexable-determiner) for more information.
