Should Zola really delete `public` each time?

I’m asking this because apart from causing a weird issue on Windows, it also raise concern on hard drive lifetime, especially SSDs.

Shouldn’t we keep public and only overwrite everything (leaving behind leftovers if any) and add a clean command to delete public?

That’s a serious issue. You can end up with random pages that you deleted or renamed. Ideally we would not write to disk at all in zola serve like Hugo does so the only writing would happen with zola build for release. That’s a huge amount of work afaik though. Until then, I think it’s better to delete when first running build or serve. serve will only re-render the minimum needed so it isn’t that bad.

Maybe some kind of incremental build support in future then, so we only write what’s needed?

It would need to support deleting files as well, which is tricky since it’s hard to know what needs to be updated. The current rebuilding has plenty of holes and misses things all the time already :frowning:

It will some kind of database yeah, how compilers are doing this in the first place?

By being written by people smarter than me :wink:
The main issue with Zola rebuilds is that we currently do not inspect the AST of the templates and the global functions means that any content can be anywhere on the site: for example you might have a sidebar shown on every page containing the last 5 articles. This means that every single page needs to be rewritten but we don’t know about it in Zola since it all lives in the templates. That’s only one example, there are a few other tricky ones: changing date/order of a page, changing transparent etc. Those ones we can do the diff but because of the global functions we don’t know if we actually need to render more than the minimum.

2 Likes

I see. Not impossible, but a really huge amount of work here.