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.
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
By being written by people smarter than me
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.