-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95eaf0e
commit 57adb8d
Showing
4 changed files
with
70 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Cnj\Seotamic; | ||
|
||
use Statamic\Events\EntrySaved; | ||
use Statamic\Events\EntryCreated; | ||
use Statamic\Events\EntryDeleted; | ||
use Illuminate\Events\Dispatcher; | ||
use Illuminate\Support\Facades\Cache; | ||
|
||
class SitemapSubscriber | ||
{ | ||
/** | ||
* Register the listeners for the subscriber. | ||
* | ||
* @return array<string, string> | ||
*/ | ||
public function subscribe(Dispatcher $events): array | ||
{ | ||
return [ | ||
EntrySaved::class => 'flushSitemapCache', | ||
EntryCreated::class => 'flushSitemapCache', | ||
EntryDeleted::class => 'flushSitemapCache', | ||
]; | ||
} | ||
|
||
/** | ||
* Flush the sitemap cache | ||
* | ||
*/ | ||
public function flushSitemapCache() | ||
{ | ||
Cache::forget('seotamic_sitemap'); | ||
} | ||
} |