These scripts will help you migrate a Jekyll blog to Micro.blog.
feed-all.json
generates a JSON feed of your site.json-to-md.py
converts the HTML in the JSON file to Markdown files that can be imported by Micro.blog.check-links.py
checks for bad links in the converted Markdown files.pip install pypandoc
pip install requests
(optional; see Check for bad links below)feed-all.json
to the root of your Jekyll site.json-to-md.py
json_file = '/<Jekyll root>/_site/feed-all.json'
: Change <Jekyll root>
to the root of your Jekyll directory.output_dir = '/<Jekyll root>/_ToMicroBlog'
: Change <Jekyll root>
to the root of your Jekyll directory.static_asset_paths = ['/images/']
: Add paths to static assets (e.g., images). Make sure you include leading and trailing slashes. Separate multiple paths with commas, e.g., ['/images/', '/assets/']
cd
to the directory that contains json-to-md.py
../json-to-md.py
and press Enter.All files will be output in /<Jekyll root>/_ToMicroBlog
.
Review posts-with-code.txt, posts-with-youtube.txt and posts-with-img.txt. Clean up anything that didn't convert cleanly.
For <img>
tags, remove any srcset
attributes (or manually upload the image files and fix the URLs after importing to Micro.blog).
For YouTube embeds, posts-with-youtube.txt will list the YouTube IDs in each post. Add {{< youtube ID >}}
to the Markdown file (replace "ID" with the ID in the file). This is Hugo shortcode for a YouTube embed. Micro.blog will translate this to the embedded video.
check-links.py
can check for bad links in your converted Markdown files. If you want to check the links, make sure you installed Requests in Setup step 5. Then type ./check-links.py
and press Enter. The script will produce a file called bad-links.txt that lists the bad links in each Markdown file. A link is considered "bad" if it doesn't return HTTP 200 (OK).
Zip your Markdown files and import the zip file to Micro.blog.