I want to migrate my old blog to Ghost. Unfortunately, my previous blog service isn’t compatible with Ghost, so I have to upload my contents one by one.
I know that I can publish my post backdated, making it look like to be posted in 2019.
But if I look into Ghost’s content directory, all of my uploaded images and videos are in 2023 directory, rather than in 2019 directory.
If I let Ghost to upload contents for post written at 2019 to 2023 directory and continue to migrate my old blog posts, the 2023 directory will have thousands of images and videos, including resized images.
I don’t want it.
I want Ghost to upload images and videos to given year/month directory, rather than current year/month directory.
Or, I want to put images and videos already uploaded to content directory. Currently, I always have to upload new images even though I can re-use same images already uploaded.
TL;DR
I want to know either one of these:
- How to make Ghost put uploaded images and videos to certain year/month directory?
- How to use images or vidoes that are already uploaded manually in editor?
Are you self-hosting or using Ghost(Pro)?
After you get all your content uploaded, you could try using gctools
find-replace feature to rename a bunch of those 2023 URLs back to another a year:
At the same time, you could log into the server and physically move them to the alternate folder you’d like to back-date them too.
Time Travel Alternative
Alternately, you could try this hack: Log into your server and set the server’s time back to a point in 2019 and then upload some posts. Ha. Assuming Ghost is using the server system clock, it would back-date them. You may need to restart Ghost after changing the system time.
Continue to time travel by setting the server system clock as needed.
Untested idea!
1 Like
Thanks, I will try using gctools
. I didn’t know that this kind of tool existed…
If gctools
don’t work, I will change server’s system time back to 2019 and see if Ghost recognizes ‘current time’ as 2019.
PS. I though that I can mark your answer as ‘Answer’ but I can’t. But If I can, I will mark your answer as ‘Accepted Answer’. Thank you a lot!
1 Like
Sorry to ask again, but I can’t use gctools
.
GitHub README says
- Run
yarn
to install
- Run
yarn link
to make it global
- (Yarn said) CD to Ghost installation directory and run
yarn link gctools
But after that, gctools
is still not recognized as valid program name.
I tried npm install https://github.com/TryGhost/gctools -g
to force install gctools
globally. But when I try to run it, it gives me error like
node:fs:1396
handleErrorFromBinding(ctx);
^
Error: EINVAL: invalid argument, mkdir '\C:\Users\[MyUserName]\AppData\Roaming\npm\node_modules\gctools\logs'
at mkdirSync (node:fs:1396:3)
at file:///C:/Users/[MyUserName]/AppData/Roaming/npm/node_modules/gctools/lib/loggingrc.js:9:5
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
errno: -4071,
syscall: 'mkdir',
code: 'EINVAL',
path: '\\C:\\Users\\[MyUserName]\\AppData\\Roaming\\npm\\node_modules\\gctools\\logs'
}
Node.js v18.16.0
I really don’t know how to handle this error.
I’ve manually exported contents as JSON and open it with Notepad++ and re-imported it as an workaround. It replaced all ‘current time’ to ‘old time’, but I prefer using ‘official’ tool instead.