cms
cms copied to clipboard
Static cache not invalidated for multisite
Bug description
I have a blog collection and entries are localised. I'm noticing that my Static Cache Invalidation rules work for my default site, but not for my subsites.
The problem occurs on my blog index page: /blog
If I unpublish an entry from the default site then it disappears from the index on the default site but if I unpublish the same entry from the subsite it remains on the blog index on the subsite.
My cache invalidation rules are like so:
'rules' => [
'collections' => [
'blog' => [
'urls' => [
'/blog'
]
],
.....
I'm using blade and this is how I retrieve entries for the blog index:
@php($tag = Statamic::tag('collection:blog')->paginate(12)->sort('date:desc')->as('articles')->fetch())
I have tried 'rules' => 'all' and it works so this seems like a bug to me. I can't see any problems with my rules.
How to reproduce
Not sure. Set up a multisite collection and unpublish the article from each site to see if it's outputted on your collection index page.
Logs
No response
Environment
Laravel Version: 9.22.1
PHP Version: 8.1.1
Composer Version: 2.2.3
Statamic Version: 3.3.24
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
No response
Additional details
No response
What if you add /subsite/blog to the list of URLs?
My site names are ie (primary) and uk.
I have added the urls below to the invalidation rules but it still only works on my primary domain:
'blog' => [
'urls' => [
'/blog',
'/uk/blog',
'/subsite/blog',
'/uk.mysite.test/blog',
'/mysite.co.uk/blog'
]
],
Would you be able to provide config/statamic/sites.php?
config/statamic/sites.php (actual site name replaced)
'sites' => [
'ie' => [
'name' => 'website.ie',
'locale' => 'en_IE',
'url' => config('app.url'),
],
'uk' => [
'name' => 'website.co.uk',
'locale' => 'en_UK',
'url' => config('app.url_uk'),
],
'com' => [
'name' => 'website.com',
'locale' => 'en_US',
'url' => config('app.url_com'),
],
],
ENV VARS
APP_URL=https://www.website.ie
APP_URL_UK=https://www.website.co.uk
APP_URL_COM=https://www.website.com
Please note we are intentionally using www in the urls for this project.
The ie and com sites have the same url in the env file. Is that correct?
@jasonvarga No, sorry. I made a typo when redacting the actual site name. I've updated it now.
This one is still a problem I am afraid. Statamic 3.4.*