statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

Apply static caching rules for navs when entry publish status changes #976

Open stuartcusackie opened 1 year ago

stuartcusackie commented 1 year ago

I have a draft item in my main navigation. When my client publishes this item it is not shown on the front-end, because the static cache is not cleared. Technically, the navigation has changed because one of its hidden items was published.

It would be great if Statamic could detect a change in publish status for any items within a nav and then proceed to follow the rules defined in config/static_caching.php.

For example, if I change the publish status of any entry linked in my 'primary' navigation then the rules below would be triggered and my static cache would be cleared:

'rules' => [
  'navigation' => [
    'primary' => [
        'urls' => [
        '/*'
      ]
    ],
....

Thanks.