Closed Aquive closed 8 months ago
An example to exclude noindex
entries from the sitemap is already in the comment of the config:
'filter' => static function ($entry): bool {
$augmented = $entry->newAugmentedInstance();
if (!($metaRobots = $augmented->get('meta_robots')) || !is_array($metaRobotsArray = $metaRobots->raw())) {
return true;
}
return !in_array('noindex', $metaRobotsArray, true);
}
This function checks whether a meta_robots
field exists, is an array type, and if it contains 'noindex' as an array value.
Here the page itself is checked. If you want to filter based on the blueprint, you have to adjust the code to read the blueprint of the page.
Thanks, exactly what I was looking for!
Is it possible t o exclude urls based on input from a blueprint?
E.g. when blueprint has set
no index = true
? If yes, how?PS: i know i can exclude urls with code, but i want a way for admins to manage it automatically.