I’m developing a plugin and part of its functionality depends on creating “snapshots” of the content, i.e. files that contain the whole site content in JSON format.
When I first thought about it - it made complete sense to put those files under a snapshots folder in my plugin. But then I thought - maybe they should be in the content folder. In one of my projects, the content is a different repository and is registered as a submodule in the site. It would make sense that snapshots are tracked in that repo. Also, If you move the content folder, you would move the snapshots as well. Since they’re a reflection of that content, that would make sense too.
My question is - how to store these files without introducing potential issues with Kirby? Can I put the files in content/__snapshots/? I tested this and no errors popped up. The “page” doesn’t appear in the panel either. It appears to be OK but I wonder if there are any hidden pitfalls.
i would have expected them to be stored in site/snapshots. anything in site folder is protected by kirbys default htaccess setup yet can be accessed using the roots. i usually put my log files there.
That’s a good idea indeed. I’ll make it configurable, but I wonder if I can safely put the content folder as a default value. Site folder makes sense for most stuff, but these snapshots should be moving along with the content and I think the content folder makes more sense, as long as it wouldn’t cause any issues.
In your case it probably makes sense to put these snapshots into the content folder. Only make sure that they are not accessible via a public URL (if they don’t pop up in the Panel, they are probably protected, but make sure this is also true for the actual snapshots). I don’t think there will be issues.