Simple set of scripts to help migrate blog content from Blogger to Ghost
- Ghost migration utils
- ruby-addressable -- URI handling
- ruby-http -- HTTP/S library that's better than Net::HTTP
- ruby-json -- JSON parsing and s
- ruby-nokogiri -- XML and HTML parsing
First and foremost, note that each of the two utilities has lots of options, and
you can see them with ghost-blogger.rb --help
or image-embedder.rb --help
.
-
Download blog export from Settings -> Manage Blog -> Back up content
-
Run
ghost-blogger.rb <path_to_blogger_export.xml> > intermediate.json
intermediate.json
will (by default) include post content under anhtml
key for each post. -
Run
npx migrate json html intermediate.json
Will produce a file named
ghost-import.json
, with translated post content under themobiledoc
key for each post. -
Run
mkdir -p content
to make sure the image download directory exists. -
Run
image-embedder.rb ghost-import.json > embedded-json-import.json
Will attempt to cache all post images in the
content
directory, and output a version of the import file where all images refer to locally-hosted files instead of files on the internet somewhere. -
Run
rm -f embedded-ghost-import.zip; zip -r embedded-ghost-import.zip content/
Will create an uploadable zip file of all the cached images. It is intentional that this file does not contain the json file.
-
Upload
embedded-ghost-import.zip
to Ghost via Settings -> Labs -> Import Content. This will host the files, and will start a background process of resizing the files so they can be provided at multiple resolutions. -
Upload
embedded-ghost-import.json
to Ghost via the same Settings -> Labs -> Import Content. This will import all of the posts. Note that it's important to do this as a separate step -- if you include the JSON in the zip file, everything will seem to work, but all of the feature images will be broken.
This project is licensed under the Apache License v2.0 - see the LICENSE file for details