Importing files

I’m playing with the idea of importing all my blog post to a micro.blog site, and I’m trying to figure out the best/easiest way to do it.

I’ve got > 1000 posts, they are in slightly different formats (front matter) but the body is in markdown. There are also a fairly large number of photos also … I haven’t counted but I guess > 1000.

The entries are stored in different hierarchies, not all are online. And now I’m trying to figure out what the easiest method of getting them online is. As I see it I have the following alternatives

  • Use Markdown import, but as I understand it this would mean that I would need to move all photos online and make sure that the URL in the posts are adjusted. It can be done but seems to be bit cumbersome.

  • Import a bar file … which would mean creating a bar file but I have no idea how a minimum bar file should look like. I couldn’t find the documentation of the format. Does anyone know where I can find it?

  • Write my own custom import script talking directly to micro.blog. I haven’t written many programs that talks to servers so that would be a learning experience for me.

I assume there are additional alternatives?

What would you recommend that I do? I looks that no matter what I select, I need to write some code.

I would almost certainly use the Markdown import. The trickiest part is making sure your front matter is in the right format, and that’s an easier programming task than the other steps, IMO.

Here’s more information about the BAR format blog archive format - IndieWeb.

I agree about trying the Markdown import first. The nice thing about it is that if you have the original path or URL in the front matter (as a url or permalink field), Micro.blog will automatically redirect the old URLs for you. That’s not currently possible if you write a custom import script.

Markdown it is

OK, I created a test blog and started to experiment a bit … however, I expect that I will find numerous files that causes the import to fail (don’t worry, I’m going to this in small batches). My idea is to import into the test blog until I know that the complete import works. So, I expect that I want redo imports a number of times.

Is there an easy way to empty the test blog without that you, @manton, has do it manually each time?

If you’re using the test blog, the easiest way is to just delete the whole blog (from the Account page) and then create it again (from Design → Edit Custom Themes).

Also, if you can have a url field in your front matter, that is ideal because you can run the import multiple times and Micro.blog will look for a post with the same URL on that blog before it tries to create a new post. So subsequent updates will just update existing posts instead of creating duplicates.

1 Like