statamic / seo-pro

An all-in-one site reporting, metadata wrangling, Open Graph managing, Twitter card making, sitemap generating, turn-key addon for Statamic.
https://statamic.com/addons/statamic/seo-pro
52 stars 33 forks source link

Feature request: more control over sitemap content #291

Closed FrankPeters closed 9 months ago

FrankPeters commented 9 months ago

It would be great to allow more control over which collections will be added to the site. We have heavily customized the way that we use collections and taxonomies and it would be helpful to disable an entire collection from being added.

I am thinking that the config file would be a great way to add an array of collections to be ignored for instance. Or maybe add a Seo Pro section to the editing screen of a collection. Or a separate section in the Sitemap settings of Seo Pro.

I have achieved this now by overriding the Statamic\SeoPro\Sitemap\Sitemap class and injecting an array into the

protected function publishedEntries() {
// ...
   ->reject(function ($entry) use($ignoreCollections) {
       return is_null($entry->uri()) || in_array($entry->collection(), $ignoreCollections);
   });
// ...
}
jesseleite commented 9 months ago

@FrankPeters You can already disable the sitemap on an entry-by-entry basis, or even a collection/taxonomy basis (using the 'Section Defaults' page)...

CleanShot 2023-09-22 at 13 28 56

Closing this for now, but if I'm missing something, feel free to speak up! ❤️