Migrate from Ghost to Squarespace

Migrate from Ghost to Squarespace

Table of Contents

Over the last few days, I’ve been exploring options for making my website faster and cheaper. While I ultimately moved to the $10 Linode option, I nearly switched to Squarespace. Meanwhile, I developed a guide on how to migrate from Ghost to Squarespace.

Migrating from Ghost to WordPress

The first step of your migration will be to convert your blog posts from Ghost to a usable format.

Exporting from Ghost

  1. Log in to your Ghost site (https://yoursite.com/ghost).
  2. Go to Settings > Labs.
  3. Under Migration Options, click Export.
  4. This will download a Ghost JSON file that will begin the process.

Converting from Ghost to WordPress

  1. Install ghost-to-wp from GitHub.
  2. Run ghost-to-wp export.json to get a usable XML file.

While this file does work with WordPress, it’s not compatible with the Squarespace WordPress import tool. Next, you’ll need to use a WordPress instance to get a usable format.

Getting a WordPress Droplet on Digital Ocean

Digital Ocean makes it fast and easy to get up and running with WordPress in just a few minutes. Once you’re signed in or signed up, just follow these instructions to get a usable WordPress instance.

  1. Click Create and then Droplets.
  2. Under Choose an Image, click Marketplace.
  3. Click the first WordPress image option.
  4. Select the Shared CPU, Basic plan at $5/mo. You’ll only need this for a few minutes.
  5. No other settings need to be adjusted, so scroll all the way down and click Create Droplet.

After a few minutes, your droplet will be created, and you can SSH in to finish setting up WordPress.

ssh root@xxx.xxx.xxx.xxx
  1. For Domain/Subdomain name, enter the droplet’s IP address.
  2. Enter your details for Username, Password, and Blog Title.
  3. Respond N for LetsEncrypt since this is a short-term instance.
Domain/Subdomain name: xxx.xxx.xxx.xxx
Your Email Address: user@email.com
Username: bluesabre
Password: ********
Blog Title: bluesabre.org
Is the information correct? [Y/n] Y

Would you like to use LetsEncrypt (certbot) to configure SSL(https) for your new site? (y/n): n

Importing the WordPress Export

  1. Login to the WordPress admin dashboard (http://xxx.xxx.xxx.xxx/wp-admin).
  2. In the sidebar, go to Tools > Import.
  3. Under WordPress, click Install Now.
  4. After it installs, click Run Importer.
  5. Click Choose File and select your converted WP_Import.xml.
  6. Click Upload file and import.
  7. Under Assign Authors, assign the posts to the existing user or create additional users as needed.
  8. DO NOT select Import Attachments. You’ll be using S3 instead later.
  9. Click Submit.

Once this finishes, you can now export an official WordPress export file!

Exporting from WordPress

  1. In the sidebar, go to Tools > Export.
  2. Select All content.
  3. Click Download Export File.
  4. This will download an export file compatible with Squarespace!

Deleting the WordPress Droplet

With the export file in hand, you no longer need your temporary WordPress instance.

  1. Go to your Droplet on Digital Ocean.
  2. Click on Destroy in the droplet sidebar.
  3. Click Destroy this Droplet.
  4. Click Confirm.

Cleaning up the WordPress Export

The WordPress export file needs some cleaning up before it can be imported. Open it in your favorite text editor and strip out every instance of “index.php/”. Without this step, your posts will be imported with the unnecessary “index.php” in the slug.

Migrating Images to Amazon S3

Squarespace didn’t import any images in my testing, so they must be hosted elsewhere. Thankfully, Amazon S3 is incredibly affordable and easy to set up.

Caveat: If your blog hosts over 2,000 photos, you will go beyond the AWS free tier with the initial data push. Be sure to read up on Amazon S3 pricing if you think you may be affected.

Configuring the Bucket

  1. Set up an account with Amazon Web Services (AWS).
  2. Once you’re logged in, go to the search at the top and enter S3. Select the S3 service.
  3. Click Create Bucket.
  4. Give your bucket a memorable name, such as domain-tld.

Uncheck Block all public access.

  1. This bucket will host your static web assets, which must be publicly accessible.
  2. For this same reason, do not use this bucket for anything else that could be sensitive.
  3. Click the checkbox to acknowledge that you are enabling public access.
  4. All other settings can remain defaulted, so scroll to the bottom and click Create Bucket.

Once the bucket has been created, upload your images from Ghost. This can be done one at a time, but you can use the AWS CLI to push the files quickly from the Ghost server.

Using the AWS CLI

Before using the AWS CLI, you must create an IAM user with S3 access permissions. The full documentation for this process can be found on Amazon, but I’ve simplified it below.

  1. Log in to your AWS IAM dashboard.
  2. In the sidebar, click Access management > Users.
  3. Click Add user.
  4. On page 1 of the Add user screen, enter a name for the user (I entered s3-upload). Select Programmatic access for the Access type. Then click Next: Permissions.
  5. On page 2, click Attach existing policies directly. A list of policies will be displayed. Search for AmazonS3FullAccess and select it. Click Next: Tags to continue.
  6. On page 3, tags are optional. Skip this step and click Next: Review to continue.
  7. On page 4, you can review the IAM user to be created. Click Create user.
  8. On page 5, you can now record your Access key id and Secret access key. These will only be displayed on this screen, so save them somewhere secure for later use.

With your S3-friendly IAM user ready to go, you can now install the AWS CLI on your Ghost server.

  1. Install the AWS CLI version 2 according to your setup.
  2. After installing, run aws configure to start setting up your profile.
  3. Use the values you recorded in step 8 above for the AWS Access Key ID and AWS Secret Access Key.

For Default region name, enter the region as found on your bucket URL (mine is us-east-2).

  1. https://s3.console.aws.amazon.com/s3/buckets/mybucket-name?region= us-east-2
  2. For Default output format, enter “json”.
  3. If everything worked correctly, you should now be able to run S3 commands. Use aws s3 ls to verify.

Finally, you have everything you need to migrate your images from Ghost to S3.

cd /var/www/ghost/content
aws s3 cp images s3://mybucket-name/content/images --recursive

This may take some time, but once it’s finished, all of your images from your Ghost server should now be available on S3.

Update the S3 Bucket Policy

Now that your files are in place, you must update the bucket policy to allow public read access.

  1. Go back to the AWS dashboard and head to the S3 service.
  2. Click on the bucket you created previously.
  3. Click on the Permissions tab and scroll down to Bucket policy.
  4. Add a policy that enables public access to the content directory.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::mybucket-name/content/*"
        }
    ]
}

With this bucket policy in place, your files will now be accessible at:

https://<bucket name>.s3.<region name>.amazonaws.com/content/images/path/to/image.png

Update the WordPress export file again

With your files now on S3, update the WordPress export file again, replacing any instances of the previous paths. Replace:

with

https://<bucket name>.s3.<region name>.amazonaws.com/content/

Your WordPress export file is finally ready to be imported into Squarespace.

Import the WordPress export file into Squarespace

  1. From the Squarespace sidebar, go to Settings > Advanced > Import / Export.
  2. Click the Import button.
  3. Click WordPress.
  4. Click the Advanced tab.
  5. Select Standard WordPress for Processor.
  6. Click Add a File and select your WordPress export file.
  7. Click Begin Import.

After a few minutes, your Ghost blog will have been successfully imported into Squarespace!

  1. Navigate back to the first level of the Squarespace sidebar.
  2. Click Pages.
  3. The name of your blog should appear under the Not Linked section.

You should now be up and running with Squarespace. I hope this guide helped make a large project a little more approachable. Thanks for reading!

Thanks to the following resources that helped me put this guide together!

comments powered by Disqus

Related Posts

FOSS Roundup #1 - Exploits and Drivers and Wayland, Oh My!

FOSS Roundup #1 - Exploits and Drivers and Wayland, Oh My!

This week's roundup includes a "simple and universal" exploit, elementary's 2021 UI study results, driver development, and Wayland news!

Read More
Mugshot 0.4.1 Released

Mugshot 0.4.1 Released

Mugshot 0.4.1 is now available! This release includes several bug fixes and code enhancements and will run in the most minimal environments.

Read More
Can't Suspend? Try Hibernation.

Can't Suspend? Try Hibernation.

Hibernation, the oft-forgotten lower power state in Linux, may be the key to extending your laptop's life, especially if you can't suspend.

Read More