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

Allow for swappable `SiteDefaults` implementation #302

Closed jesseleite closed 8 months ago

jesseleite commented 8 months ago

With this PR, you can now override where site defaults are stored by providing a custom SiteDefaults implementation:

$this->app->bind(\Statamic\SeoPro\SiteDefaults::class, \App\MySiteDefaults::class);

This is for @ryanmitchell to store site defaults in a database by overloading the save and getDefaults methods ❤️

Closes #298 (This PR is just a slightly simpler alternative)

jesseleite commented 8 months ago

Thoughts on this @ryanmitchell? Do you see any downsides to this approach?

Also curious if you have need to override the blueprint() method? If so, I could make this method non-static / an overridable instance method 👍

ryanmitchell commented 8 months ago

Definitely simpler, i should have read the code more fully and done that :)

We don't need to override the blueprint method but it may be a good idea to change it for others.

jesseleite commented 8 months ago

Re: Blueprint method... Agreed and done 🤘