|
7 | 7 | use SilverStripe\Control\Director; |
8 | 8 | use SilverStripe\Core\Manifest\ModuleLoader; |
9 | 9 | use SilverStripe\SiteConfig\SiteConfig; |
| 10 | +use Symbiote\Multisites\Model\Site; |
10 | 11 | use Symbiote\Multisites\Multisites; |
11 | 12 | use Wilr\GoogleSitemaps\GoogleSitemap; |
12 | 13 |
|
@@ -136,17 +137,30 @@ public function getDisallowedPages() |
136 | 137 | } |
137 | 138 |
|
138 | 139 | if ($isGoogleSitemapsEnabled) { |
139 | | - $googleSitemap = GoogleSitemap::singleton(); |
| 140 | + $pages = SiteTree::get(); |
| 141 | + |
| 142 | + $isMultisitesEnabled = ModuleLoader::inst() |
| 143 | + ->getManifest() |
| 144 | + ->moduleExists('symbiote/silverstripe-multisites'); |
| 145 | + if ($isMultisitesEnabled) { |
| 146 | + $pages = $pages->exclude([ |
| 147 | + 'ClassName' => Site::class |
| 148 | + ]); |
| 149 | + } |
| 150 | + |
| 151 | + $googleSitemap = GoogleSitemap::singleton(); |
140 | 152 | $isFiltered = (bool) $googleSitemap->config()->get('use_show_in_search'); |
141 | 153 | $filterFieldName = 'ShowInSearch'; |
142 | 154 | if (method_exists(GoogleSitemap::class, 'getFilterFieldName')) { |
143 | 155 | $filterFieldName = $googleSitemap->getFilterFieldName(); |
144 | 156 | } |
145 | 157 | if ($isFiltered) { |
146 | | - return SiteTree::get()->exclude($filterFieldName, true); |
| 158 | + $pages = $pages->exclude($filterFieldName, true); |
147 | 159 | } else { |
148 | | - return SiteTree::get()->filter(['Priority' => '-1']); |
| 160 | + $pages = $pages->filter(['Priority' => '-1']); |
149 | 161 | } |
| 162 | + |
| 163 | + return $pages; |
150 | 164 | } |
151 | 165 |
|
152 | 166 | return null; |
|
0 commit comments