Squarespace to Ghost
I finally decided to take the leap and move from Squarespace.com to Ghost. It's taken me some time to get Ghost set up on DigitalOcean as the image provided by DO doesn't seem to work out of the box, but having surpassed that obstacle π it was time to move my articles from Squarespace to Ghost and here come more problems.
The issue is that there isn't an export / import functionality from Squarespace to Ghost, or and integration that would facilitate the move so I had to hack something up with the functionality I had available.
Squarespace does provide the ability to export a file (https://support.squarespace.com/hc/en-us/articles/206566687-Exporting-your-site) and import it to a Wordpress site but the exported file is an XML file and Ghost is not able to import the same file. In fact Ghost provides an installable plugin (https://ghost.org/faq/migrating-from-wordpress-to-ghost/) for Wordpress to export the site to a Ghost JSON file.
So the solution I came up with was to export the XML file from Squarespace, create a simple Node.js application to read the XML file and use Ghost Admin API to add the posts to my blog.
- Create a new folder and create the index.js and package.json files from the Gist below.
- Run
npm install
or if you use yarn runyarn install
to install the necessary packages.
3. Next setup Ghost on your preferred hosting (I use a $5 Droplet from DigitalOcean) and then setup a custom integration following the guide from Ghost here https://ghost.org/integrations/custom-integrations/#add-a-new-custom-integration.
4. Copy and replace the Admin API key and the API URL in the index.js file.
5. Export the Squarespace site and move the export file to the same folder you created the index.js file. Rename the file to squarespace.xml or otherwise change the filename in the index.js file to match the file name and location.
- Once you've set up everything run
npm run create
oryarn create
to process and import the posts from the XML file.
Check your Ghost site and make sure that the posts were created correctly. The script doesn't import the images from the XML file, I had to manually upload them and update the posts accordingly.