Skip to content

Commit

Permalink
Merge pull request #15 from muskie9/pull/redirectorPageExclusion14
Browse files Browse the repository at this point in the history
BUGFIX RedirectorPage::Link() results in unexpected disallows
  • Loading branch information
tractorcow authored Aug 18, 2020
2 parents 9c29225 + fa93f2a commit 72a423e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Robots.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function disallowedUrls()
{
// If not public, disallow all
if (!$this->isPublic()) {
return array("/");
return ["/"];
}

// Get configured disallowed urls
Expand All @@ -150,6 +150,11 @@ protected function disallowedUrls()
if (static::config()->get('disallow_unsearchable')) {
/** @var SiteTree[] $unsearchablePages */
$unsearchablePages = SiteTree::get()->filter(['ShowInSearch' => false]);

if (class_exists('SilverStripe\CMS\Model\RedirectorPage')) {
$unsearchablePages = $unsearchablePages->exclude('ClassName', 'SilverStripe\CMS\Model\RedirectorPage');
}

foreach ($unsearchablePages as $page) {
$link = $page->Link();

Expand Down

0 comments on commit 72a423e

Please sign in to comment.