WithCandour / statamic-aardvark-seo

Candour's SEO addon for Statamic
https://statamic.com/marketplace/addons/aardvark-seo
11 stars 18 forks source link

Registration of Aardvark content saved events with Statamic's Git listener? #122

Closed jesseleite closed 2 years ago

jesseleite commented 2 years ago

Hi there!

We're working with a user on Statamic not automatically committing changes to the aardvark_redirects file. There's two issues with this that we're seeing...

1) Aardvark's redirects seem to be stored within storage/statamic, which is gitignored by default. Getting these redirects committed would require your end users to have to add this to the above linked gitignore file (as mentioned by @mikemartin over in this issue):

```
/*
!.gitignore
!/addons/
```

Maybe aardvark redirects should be stored elsewhere, outside of a gitignored folder like storage/statamic?

2) Also, it seems you have multiple content events that implement ProvidesCommitMessage, but are not registered with Statamic's Git listener?

Maybe you can register listeners for your content event in Aardvark's service provider? All you should have to do is:

```php
\Statamic\Facades\Git::listen(YourEvent::class);
```
AndrewHaine commented 2 years ago

Hi @jesseleite ,

Thank you for the detailed explanation, you're correct in that our current solution is to edit the gitignore file in the storage directory which admittedly is a little hacky. Our roadmap for the next minor release (Aardvark 2.1) includes moving the stored Aardvark files to the content directory (While maintaining backwards compatibility for folks who already have Aardvark variables present in the storage directory).

As for registering the listeners, this was not something we were aware was possible but we should be able to test and release a patch for this in the next few working days :)

Thanks, Andrew

AndrewHaine commented 2 years ago

Hi @jesseleite ,

Just wanted to drop a note to say that this has now been implemented in Aardvark 2.0.23, and documentation has been added for getting the Git integration working with the current setup.

Of course, this isn't the long-term solution, we're looking to move to custom Stache repositories and moving the content to be stored in the content/ directory but we're going to need time to fully test this and make it backwards compatible so expect to see this in 2.1.

Thanks, Andrew

jesseleite commented 2 years ago

All good! I'm not using Aardvark myself, just was debugging with one of our users who is using it. Thanks for reply though!