Developer docs

Migrating from Medium

Migrate from Medium and import your content to Ghost with this guide

The Ghost Concierge team, at your service

Let us handle the Medium migration for you! This migration is included when you make an annual payment on the Ghost(Pro) Creator, Team, or Business plans. Send an email to concierge@ghost.org to learn more and get started.

Developers can migrate content from Medium to Ghost using our migration CLI tools.

You will first need to export your content from Medium. This contains all of your data, including your posts.

Medium only offers an export of all content to individual authors. If your publication has more than one author, each author needs to export their content, and then you need to run the migration command below for each author.

First, make sure the CLI is installed.

# Install CLI
npm install --global @tryghost/migrate

# Verify it's installed
migrate

# Run the migration
migrate medium my-export-file.zip

Once the CLI task has finished, it creates a new ZIP file which you can import into Ghost.

Using custom domains

If you’re using a custom domain on Medium, you’ll need to implement redirects in Ghost to prevent broken links.

Medium appends a small random ID to each post, which is removed in the migration step above. The regular expression below removes that random ID, but does not affect preview links.

# redirects.yaml
301:
    ^\/(?!p\/?)(.*)(-[0-9a-f]{10,12}): /$1

302:

This means that if a visitor or crawler goes to https://mysite.com/aweosme-post-a1b2c3d4e5f6, they will automatically be redirected to https://mysite.com/aweosme-post.


Summary

Congratulations on your migration to Ghost πŸ™Œ. All that’s left to do is check over your content to ensure the migration has worked as expected. We also have a guide on how to implement redirects to make your transition smoother.