Forum

Thread tagged as: Question

Remove blog posts after X time period

I have a client who currently uses the blog to upload a daily workout diary. Unfortunately these posts can be image heavy and the resource folder is already 3GB after a year and a half. I've stressed the importance of compressing images but I'm wondering if it'd viable to make a script to remove posts from a certain section after a set time period? If those posts were deleted would the corrosponding assets also be removed?

Mathew Doidge

Mathew Doidge 2 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure if Blog deletes unused assets, but I think so. What issue are you trying to solve - just storage space? Might be better to switch to a solution with cheaper storage than start deleting content.

Hi Drew,

I think I've arrived at the same conclusion. I came across bucket handlers this morning in the docs, so I may try something like S3 or Memset storage and go down that route. Thank you for for replying.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

From experience, deleting a blog post doesn't remove assets associated with it. I think of uploading images to a post as uploading assets to Perch (not the post) and then linking the image to the post.

Even if Blog deleted the assets, I agree with Drew; I don't think deleting content from your client's website is the ideal solution.

Is using the Kraken App to optimise images an option? It is a paid service though.