yukihiko-shinoda / staticpress2019

[WordPress Plugin] StaticPress2019 - A WordPress plugin to Export your WordPress to static site
https://wordpress.org/plugins/staticpress2019/
13 stars 4 forks source link

Unpublished pages are not removed from static sites #14

Open W7KaMSLL9p0lkWtF opened 1 year ago

W7KaMSLL9p0lkWtF commented 1 year ago

Hello. I'm using staticpress2019 and staticpress2019-s3 to publish static sites to S3, but I have one problem. When I unpublish the page or delete image files and rebuild the static site, those unnecessary files remain on the static site and are not deleted from S3. Is there a way to automatically delete unnecessary files? Should I just delete it manually? thank you.

yukihiko-shinoda commented 1 year ago

Hello, unfortunately, I know that no function for this issue has been implemented since original StaticPress published. And I think that it's quite difficult to implement its function to StaticPress2019.

One of solution idea is:

Note that I haven't tested it and AWS DataSync requires additional fee.

cf:

W7KaMSLL9p0lkWtF commented 1 year ago

Thank you for your solution idea! I tried AWS DataSync and it worked pretty well.

However, one additional step was required. Before uploading with StaticPress-S3, I had to flush not only the staging bucket, but also the local directory where static files are output. Otherwise, the image files and theme files will not be uploaded to the staging bucket, and running AWS DataSync in that situation will also delete the image files and theme files from the production bucket.

Anyway, adding the above steps solved the problem and I no longer have to delete the unnecessary files one by one. thank you.