Mity Docs Mity Docs for Mity Digital
Sitemapamic Documentation

Clearing the sitemap

Your sitemap is cached forever. Well, until you clear it that is, or your ttl is set to an actual interval (check the config for more).

To clear the cache, you can do one of three things:

  • update Sitemapamic’s configuration

  • change content via the CP

  • have an entry change its state

  • run a please command

Events that trigger a clear

Sitemapamic listens for a number of Statamic events to clear its cache:

  • Statamic\Events\CollectionDeleted

  • Statamic\Events\CollectionSaved

  • Statamic\Events\CollectionTreeDeleted

  • Statamic\Events\CollectionTreeEntriesMovedOrRemoved

  • Statamic\Events\CollectionTreeSaved

  • Statamic\Events\EntryDeleted

  • Statamic\Events\EntrySaved

  • Statamic\Events\EntryScheduleReached

  • Statamic\Events\LocalizedTermDeleted

  • Statamic\Events\LocalizedTermSaved

  • Statamic\Events\SiteCreated

  • Statamic\Events\SiteDeleted

  • Statamic\Events\SiteSaved

  • Statamic\Events\TaxonomyDeleted

  • Statamic\Events\TaxonomySaved

  • Statamic\Events\TermDeleted

  • Statamic\Events\TermReferencesUpdated

  • Statamic\Events\TermSaved

Additionally, if you use our Scheduled Cache Invalidator addon:

  • MityDigital\StatamicScheduledCacheInvalidator\Events\ScheduledCacheInvalidated

Clear the entire cache

You can force the entire cache to clear by running:

1php please sitemapamic:clear

This could be a good command to have as part of your deployment script.

Clear the cache of a specific site

You can force the cache of a specific site to be cleared by providing the site param to the command:

1php please sitemapamic:clear --site=fr

This would clear the fr site from the cache.