Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSG had trouble with a clear cache, navs fail #191

Open
efc opened this issue Jan 4, 2025 · 0 comments
Open

SSG had trouble with a clear cache, navs fail #191

efc opened this issue Jan 4, 2025 · 0 comments

Comments

@efc
Copy link

efc commented Jan 4, 2025

The Statamic SSG v.3.1.0 seems to have a problem dealing with child pages when the cache is clear.

To demonstrate the problem, first install statamic with this starter kit.

statamic new ssgkidsbug efc/ssg-kids-bug

Then visit the site to see how it is laid out. This is a vanilla Statamic site with a bit of content added to the pages. That is all. Nothing else has been changed.

Notice that each page includes some info about it parent and parent's children (if it has a parent) and a list of its children (if it has children). You can look at the /resources/views/default.antlers.html to see how these lists are made.

To trigger the bug, you will have to php artisan cache:clear and then run php please ssg:generate.

When SSG generates a site from a clear cache, things go badly. Take a look at the pages in the generated static site. Notice that the "children" are always children of the root page, this is true of both the parent's children and the children of the current page.

Furthermore, if you immediately try to access the Laravel version of the site with a browser, you will find that every page returns a 404.

It appears that when SSG builds from a clear cache it both cannot corretly build navs and it leaves behind a cache that is poison to the Laravel site.

If you now clear the cache again with php artisan cache:clear, the Laravel site will recover. After browsing around a bit (to fill the cache?), if you build the static site without clearing the cache using php please ssg:generate, then it will build a static site without the errors. The Laravel site should also still be healthy.

Is something wrong with the way SSG deals with a clear cache?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant