bastibe / org-static-blog

A static site generator using org-mode
BSD 3-Clause "New" or "Revised" License
341 stars 74 forks source link

Add a function to clean org-static-blog-publish-directory #82

Closed adithyaov closed 3 years ago

bastibe commented 3 years ago

Could you comment on when this function would be needed?

adithyaov commented 3 years ago

Say we want to delete a post. Deleting the .org file and publishing the blog does not automatically delete the .html file produced. I've run into this problem when I renamed a .org file and noticed that the .html file with the previous name existed as well.

In general I think every program that produces files should have some mechanism to clean them up as well.

bastibe commented 3 years ago

In that case, it might be better to only delete HTML files that don't have a matching ORG file, I think. Would you like to add this functionality to the PR?

adithyaov commented 3 years ago

That's not the main objective of this function. It is analogous to make clean. The idea is to delete all build objects, in this case, all the generated files.

This can also be used to cleanly generate the site.

bastibe commented 3 years ago

I am a bit reluctant to merge this, because users might put custom HTML files into their publish-directory. Simply deleting all HTML and XML files feels very unsafe, to be honest.

adithyaov commented 3 years ago

Simply deleting all HTML and XML files feels very unsafe, to be honest.

How about an option to specify extra-files that are treated differently? Any custom HTML file should be specified there.

bastibe commented 3 years ago

Perhaps that, and let's not touch any file outside of org-static-blog-publish-directory. (I think we're not publishing anything to subdirectories, right?)

adithyaov commented 3 years ago

I think we're not publishing anything to subdirectories, right?

No. We have a flat directory structure.

bastibe commented 3 years ago

I am closing this due to inactivity. Feel free to reopen if you want to continue work on this.