aerni / statamic-advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind
https://statamic.com/addons/aerni/advanced-seo
11 stars 6 forks source link

Make view composer configurable #100

Closed faustbrian closed 12 months ago

faustbrian commented 1 year ago

Hey, I just encountered an issue with this package that could be easily resolved, but I wanted to ask before submitting a pull request. The issue arises here: ServiceProvider.php Line 195. The package assumes that we want to apply the view composer to all views in the entire project. This works well if you're running Statamic as a standalone project. However, when using Statamic as part of an existing project that stores views in another directory—let's say resources/views/statamic—the view composer still applies to everything outside of that directory. In my case, I would need a pattern like statamic.* instead of *. I could submit a PR to make this configurable.

aerni commented 1 year ago

That sounds like a thoughtful addition. However, there are other views that the view composer should be applied to. From the top of my head that's the Advanced SEO head view and the layout/template views of the social images generator. So these paths have to be considered as well. Those paths should probably not be configurable and simply be merged with the configurable path. The view composer also accepts an array.