I made a Node.js script to import my Markdown with Frontmatter post from my Hugo blog into Micro.blog.
You are welcome to use it and here is how you set it up.
- You need to have Node and npm installed.
- Create a folder with a name like “microblog-import”.
- Proceed to that folder in your terminal and install the required modules with
npm install gray-matter got query-string.
- In that folder you have to have a folder called “posts”.
- That folder has to contain all of your Markdown posts.
- The Frontmatter properties that the script is interested in are
draft. It will ignore all files with
draft: true, for all other files it will import them to Micro.blog titled with the value in the
title property and dated with the value in the
- Now create a file called index.js in your microblog-import folder and copy-paste the following code into it:
- Go to micro.blog/account/a…
- Where it says “App name:” type in “Import Script” and then click on “Generate Token”.
- Copy the generated token and substitute the string
<YOUR_AUTH_TOKEN> with that token in the index.js file.
- In the terminal, in that folder, run the script with
That should do it. If needed, this could be extended and made into a command-line tool or even an Electron app with a GUI.
Happy new year 🎉.