Automatic Responsive Images - Updating Historical Images

I’m really excited that Ghost now supports automatic responsive images, however I’ve noticed that my historical images have not been automatically updated. Are there plans for a migration tool/command or are there some manual steps that I can run without having to re-upload every image in every post?

Ghost details:

Great spot, you’re absolutely correct that we’ve updated the way we render content to automatically output responsive images, but haven’t yet pushed out changes to old content.

We have every intention of running a migration to do this in the next major upgrade, but it takes too long for a normal minor version bump. We also have a few more changes to rendering we want to get done before then :slight_smile:

In the meantime though, you can absolutely do this yourself and we have written tooling for it to help.

You can find the scripts in our api demo repo:

There two - the main one is force-rerender.js, which will do the work of rerendering every post on your site, and the second is force-rerender-single.js that will allow you to test out rerendering on a single post by passing it a slug.

There’s a usage explanation at the top of the file, but in short:

  • you can run it from anywhere
  • you’ll need node
  • follow the repo install guide
  • run the script following the usage, passing it your API url and key

Let me know how you get on and if you have any questions about how to get this going :slight_smile:

1 Like

Thanks so much for the quick response! I’m in no rush, I was just curious. I’ll carry on with my theme remediation and see how long it takes me to finish, it would be interesting to do a force-rerender of all my posts.

I’ll let you know if I get stuck, thanks again.

1 Like