How to migrate your blog from WordPress to Hashnode

I'm a software consultant who loves to build projects and share my learnings on this blog.
Search for a command to run...

I'm a software consultant who loves to build projects and share my learnings on this blog.
it's not work, I try this method.👇
I don't understand this 👇
Clean the downloaded posts This step processes the posts in ./posts.json and performs the following actions:
removes dirty attributes from content HTML converts post content to Markdown writes a new file in ./posts/cleaned.json
Did you execute the npm run cleanse command mentioned as part of the "Clean the downloaded posts" step? What error did you notice?
I solved my problem, I use the RSS method it's easy to compare this method.
Thank you, Kumar Ashwin Hubert! I just went through your tutorial, and it worked perfectly! I've moved all content from my WordPress to Hashnode.
Azure Functions is a powerful serverless compute platform, and Azure App Service handles a lot of the underlying configuration for you out of the box. However, there are scenarios where you may want t

If you’ve been exploring Azure AI learning paths or watching older demos, you’ve probably run into something confusing: The documentation and training links often reference Foundry (Classic) But the portal you’re using today might show Foundry (New...

In today's digital age, speed is paramount for web and mobile applications. Users expect instantaneous responses, and any delay can lead to a poor user experience and loss of engagement. Therefore, as developers, it's crucial to build web APIs that a...

Loops are fundamental constructs in any programming language. But have you ever wondered if there are any performance differences between them? For small collections, the difference might be negligible, but what about handling a million or 10 million...

When using an Azure Function app, it is necessary to connect it to a storage account, often referred to as Host storage. This storage is utilized by the Functions runtime, as well as by various triggers and bindings to coordinate between multiple run...

This is a step-by-step guide for migrating a blog from WordPress to Hashnode.
Thanks to Tina Holly's blog post and scripts which helped me migrate my WordPress blog site to Hashnode. This blog post builds on the same but provides a more detailed guide on the migration.
We will cover the migration in 4 main steps :
To begin the migration, you would need to first download your existing posts on WordPress. By default, these are in XML format, but we will use the WP Import Export Lite to export the posts as JSON.

Export option in the plugin. 
Post.JSON.Customize Export File button at the top right corner to begin the export. 
Download button to download the post's json file. 
{
"ID": "161",
"Title": "Understanding CRON Expressions",
"Content": "Many Azure resources like web jobs, Azure functions, logic apps use CRON expression [...]",
"Excerpt": "",
"Date": "August 29, 2018",
"Post Type": "post",
"Permalink": "http:\/\/kumarashwinhubert.com\/2018\/08\/29\/understanding-cron-expressions\/"
}
posts.jsonNext, you will need to download all your images from WordPress. Images are stored in the ./wp-content/uploads directory by year and month. There are many ways to download the images, but the easiest one is to use an SFTP tool to download this folder.
wp-content/
└── uploads
├── 2018
│ ├── 01
│ ├── 02
│ └── 03
└── 2019
├── 01
├── 02
└── 03
Note: Currently there's no automatic way to migrate the images along with your blog post content. This article targets manually uploading the image to hashnode's CDN and updating the migrated blog posts at the end. In case you wish to use some other storage provider, please upload the images and replace the url in the posts.json file before proceeding further.
Hashnode has a GraphQL API. It's somewhat limited in functionality but has most of the basic features. The API we intend to use is the createPublicationStory; but instead of manually cleaning the downloaded posts json and creating the request body to hit the API, we can use the migration scripts present in WordPress-Hashnode Migrator GitHub project.
The next set of steps will use this GitHub project to clean and publish the posts. This project is a node application hence ensure node is installed on your system.
posts.json from the earlier step to the root of the cloned project..env.sample to .env
The folder structure will look like this:

npm install
This step processes the posts in ./posts.json and performs the following actions:
Run the following command to clean the posts.
npm run cleanse
Ensure that you have already created a Hashnode site; if not, now would be a good time to create one as we need the Publication_Id and API_Key to continue.
https://hashnode.com/[Publication_Id]/dashboardGenerate New Token..env file in the project. Replace the HASHNODE_PUBLICATION_ID value with your publication id and HASHNODE_API_KEY with your generated key. The .env file should look like this :
HASHNODE_PUBLICATION_ID=602xxxa999eabxxxxxxx1a9b
HASHNODE_API_KEY=030xx44x-exx6-4xx4-8xxe-52xxxxxxxx1a
Save the .env file and head back to the terminal and run the following command to publish the posts to hashnode.
npm run migrate

Once the script executes successfully, the blog posts would have been published to your hashnode site.
Currently backdating the posts is not supported in Hashnode's GraphQL API, hence it's required to manually update the backdate on each of the posts.
Navigate to each of the migrated posts and click on Edit -> Settings and set the backdate. Also set the tags & Cover Image if required.

As mentioned earlier, there isn't an easy way to migrate the images from your WordPress blog. You need to manually update the image in each blog post.
Navigate to each of the migrated posts and you would see the references to old images in the form of /wp-content/uploads/2020/08/filename.png. Use the Upload an image option in hashnode editor to upload the image from the WordPress images downloaded earlier.

That's it !!!
Your hashnode blog is up and running with all your migrated WordPress posts.
Hope this helped you in your migration journey from WordPress to Hashnode.