Jekyll to Day One

After pushing my post on How I Use Day One live the other day, I got to thinking about other Day One use cases that I wasn’t actively exploring which might be useful or interesting. The first one that came to mind was something I had considered in the past but rejected for largely refutable reasons: storing a backup of the posts on this site. Since my posts are already markdown-formatted, storing them in Day One should have been something I did ages ago, but I had wanted to keep my first post date to my younger son’s birthday. Since my blog existed before that, storing those posts in Day One would “mess things up” in some sense.

Except it was my own stupid rule so I got over it.

Now, since it’s all Markdown, I could just copy and paste every single entry into Day One, update the date/time, add some tags, and repeat… but that’s a lot of work and absolutely no fun. Instead I spent my Sunday afternoon writing a python script to parse the YAML front-matter for each post, re-format any content which used Liquid tags and Jekyll plugins, and rip out images to a local directory so that all of this could be imported to a Blog journal via the Day One CLI.

This mostly worked, except where it did not, for instance

  • Any remote images whose links were broken. The code doesn’t handle that situation, so I had to manually fix the whole two posts that were like this.
  • Sometimes an entire post would be in italics or bolded after import. I saw nothing consistent about these, and I suspect a Day One issue as I’ve had random “stuck in italics” problems on the Mac client that I cannot reliably reproduce.
  • Day One no longer technically supports footnotes. They still work for now, but I’m wary and in a few spot-check cases I just removed them and put the content in-line. This isn’t much of a backup but makes the post more portable to a non-Markdown-based system in the future. Maybe.
  • There is no valid way to use a strike-through in Markdown, so in my blog entries I used s tags. Those translate as code fragments in Day One, which is weird looking. It’s just a visual abberation.
  • Any cross-reference links that make use of Liquid tags (e.g. ) just stay like that. I fixed those ~30ish posts manually.
  • Any time my Liquid syntax or YAML front-matter wasn’t perfect. Jekyll is more forgiving than me, apparently, so there were a few posts that threw really ugly error messages when their imports failed.
  • Too many markdown reference-style links in a post just break the entry and the links stop working. I only had a couple of posts like this but they required a lot of work to fix.

Of the 232 posts that I imported, about 55 had something about them which needed to be fixed.

Since the script might be useful to someone else, I put it up on Bitbucket. You can find it here. I have a little clean-up to do in the repo, but it’s serviceable.

My “Journal” journal still has the start date that’s important to me, but now my site’s posts are preserved in another format that’s just as, if not more, important to me.

Dec 4th, 2018

Comments