How to change the path for image?

So, I noticed when I add a featured image or otherwise Ghost uses a path like this:


If I create a new post and back date it (importing old posts from a previous site), I can easily set the publish date of the article itself and that works fine. But this leaves any of the images associated with that article with today’s date instead of one which matches up with the article publish date.

This bothers me a bit actually.

Why is the date included in the pathname? How can I change this behavior? Can I make the path something like /content/images/size/w300/filename.jpg? Or can I make it so the date matches the article publish date something like /content/images/size/w300/2019/12/filename.jpg?

How may I implement these changes?

Any help or insight would be greatly appreciated.

Is the pathname for image files even configurable? Or is this the sort of thing in which I would need to modify the source code?

Any progress regarding this question? For me I want to add post id to the path so that I can delete the images associated with a post when a post gets deleted. Currently I am using google storage bucket.


Not any luck yet! I was also hoping if I used Gatsby it would change the paths, just a chance that it would, but it does not either. It keeps the same path with the date. To my knowledge there is no way to change this? Perhaps we could make the changes in the mysql database, but this is surely a lot of work for each image?

I’ll keep looking into it and will definitely update if I come up with any kind of solution.

1 Like

Great for now I will start with using the image file name. I will check if it is used in any post, if not I will just delete the image.

If you want to go the manual route a la changing the mysql database, then the way I’ve done it in the past is to export the blog content (a JSON file), then use a code editor to change the file directory dates.

You wouldn’t be editing directories as such:


but rather as such:


since the /size/w___/ directories are created by Ghost itself for responsive images and only exist on the server itself.

Hope that helps!